threads / patch / 12909

patchAllow git config files to use keys containing the hyphen character '-'

Subject: [PATCH] Allow git config files to use keys containing the hyphen character '-'

## tl;dr

One message between Mar 28, 2008 and Mar 28, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

thadh@google.com· Mar 28, 2008, 23:15 UTC · lore
From: Thad Hughes <thadh@thad.corp.google.com>
---
 .../src/org/spearce/jgit/lib/RepositoryConfig.java |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
Show changes to org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java +4 −1
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
index 78ceba7..42b2c5d 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/RepositoryConfig.java
@@ -496,7 +496,10 @@ public class RepositoryConfig {
 					}
 				}
 				break;
-			} else if (Character.isLetterOrDigit((char) c)) {
+			} else if (Character.isLetterOrDigit((char) c) || c == '-') {
+				// From the git-config man page: 
+				//     The variable names are case-insensitive and only 
+				//     alphanumeric characters and - are allowed.
 				name.append((char) c);
 			} else if ('\n' == c) {
 				r.reset();
-- 
1.5.4.2.156.ge3c5

← back to recent threads