Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318249

Summary: Extra double quotes in the config file section name
Product: [Technology] EGit Reporter: Dobes Vandermeer <dobesv>
Component: CoreAssignee: Mathias Kinzler <mathias.kinzler>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: stefan.lay
Version: unspecified   
Target Milestone: 0.9.0-M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Dobes Vandermeer CLA 2010-06-28 16:42:04 EDT
Build Identifier: 20100218-1602

EGit seems to create an invalid config file if a branch name requires quoting, for example in my case it output this:

[branch ""#1063-GWT-Unit-Tests""]
	remote = origin
	merge = "refs/heads/#1063-GWT-Unit-Tests"

which was rejected by both EGit and command line git's parsers as an invalid configuration directive.


Reproducible: Always

Steps to Reproduce:
1. Create a branch named "#1234-test"
2. Add a new remote
3. See extra ""'s in the config file
Comment 1 Mathias Kinzler CLA 2010-08-27 08:02:27 EDT
Branch name validation code review at http://egit.eclipse.org/r/#change,1144
Comment 2 Mathias Kinzler CLA 2010-08-27 08:55:16 EDT
Branch name validation and specification does acutally allow #. The bug is somewhere in the clone coding. The command line clones correctly.
Comment 3 Mathias Kinzler CLA 2010-08-27 11:13:13 EDT
Ok, this happens in Config.toText():

	public String toText() {
		final StringBuilder out = new StringBuilder();
		for (final Entry e : state.get().entryList) {
			if (e.prefix != null)
				out.append(e.prefix);
			if (e.section != null && e.name == null) {
				out.append('[');
				out.append(e.section);
				if (e.subsection != null) {
					out.append(' ');
					out.append('"');
					out.append(escapeValue(e.subsection));
					out.append('"');
				}

The escapeValue() method proably needs to be extended so that it doesn't "inquote" in this special case.
Comment 4 Mathias Kinzler CLA 2010-08-30 05:21:53 EDT
A fix is proposed at http://egit.eclipse.org/r/#change,1452
Comment 5 Mathias Kinzler CLA 2010-09-03 07:19:42 EDT
Merged as 2941d23e7ebaa524e7d9efbaf69565a57042d048