diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-05-04 16:25:20 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-05-04 16:25:20 -0700 |
commit | dd63f5cfc17d6f52a54e0c6442ea3bed42043b36 (patch) | |
tree | 281669577535255b37a70e6d82264e9da6703e3b /org.eclipse.jgit | |
parent | d011a377cbf30738a1a2d9b156cf869346adb537 (diff) | |
download | jgit-dd63f5cfc17d6f52a54e0c6442ea3bed42043b36.tar.gz jgit-dd63f5cfc17d6f52a54e0c6442ea3bed42043b36.zip |
Fix FooterLine.matches(FooterKey) on same length keys
If two keys are the same length, but don't share the same sequence
of characters, we were incorrectly claiming they still matched due
to a bug in the for loop condition. I used the wrong variable and
the loop never executed, resulting in equality anytime the two keys
being compared were the same length.
Use the proper local variable to loop through the arrays, and add
a JUnit test to verify equality works as expected.
Change-Id: I4a02400e65a9b2e0da925b05a2cc4b579e1dd33a
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java index 541f2748e7..530200b0ca 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/FooterLine.java @@ -90,7 +90,7 @@ public final class FooterLine { int bPtr = keyStart; if (keyEnd - bPtr != len) return false; - for (int kPtr = 0; bPtr < len;) { + for (int kPtr = 0; kPtr < len;) { byte b = buffer[bPtr++]; if ('A' <= b && b <= 'Z') b += 'a' - 'A'; |