[JGIT PATCH 10/12] Match config subsection names using case sensitive search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The subsection name is case sensitive, and should be matched as such.

Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx>
---
 .../src/org/spearce/jgit/lib/Config.java           |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java
index e379c37..974ffea 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Config.java
@@ -4,6 +4,7 @@
  * Copyright (C) 2008, Shawn O. Pearce <spearce@xxxxxxxxxxx>
  * Copyright (C) 2008, Thad Hughes <thadh@xxxxxxxxxxxxxxxxxxxx>
  * Copyright (C) 2009, JetBrains s.r.o.
+ * Copyright (C) 2009, Google, Inc.
  *
  * All rights reserved.
  *
@@ -1024,17 +1025,25 @@ private static String readValue(final BufferedReader r, boolean quote,
 
 		boolean match(final String aSection, final String aSubsection,
 				final String aKey) {
-			return eq(section, aSection) && eq(subsection, aSubsection)
-					&& eq(name, aKey);
+			return eqIgnoreCase(section, aSection)
+					&& eqSameCase(subsection, aSubsection)
+					&& eqIgnoreCase(name, aKey);
 		}
 
-		private static boolean eq(final String a, final String b) {
+		private static boolean eqIgnoreCase(final String a, final String b) {
 			if (a == null && b == null)
 				return true;
 			if (a == null || b == null)
 				return false;
 			return a.equalsIgnoreCase(b);
 		}
-	}
 
-}
\ No newline at end of file
+		private static boolean eqSameCase(final String a, final String b) {
+			if (a == null && b == null)
+				return true;
+			if (a == null || b == null)
+				return false;
+			return a.equals(b);
+		}
+	}
+}
-- 
1.6.4.rc1.186.g60aa0c

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]