diff options
author | Robin Rosenberg | 2012-01-15 01:28:52 +0000 |
---|---|---|
committer | Code Review | 2012-01-15 01:28:52 +0000 |
commit | 02729810f9246b9f332945f730d65c68f118d489 (patch) | |
tree | b7317309ad2a053374c64e9ac187675a2612c4c5 /org.eclipse.jgit | |
parent | b8830d7bbbc206f3f56d06b21814b14b51d69f4f (diff) | |
parent | c963e7aacf4d8eaed0081ad31a29344a3cd9cd5a (diff) | |
download | jgit-02729810f9246b9f332945f730d65c68f118d489.tar.gz jgit-02729810f9246b9f332945f730d65c68f118d489.tar.xz jgit-02729810f9246b9f332945f730d65c68f118d489.zip |
Merge "Resolve ~ with no trailing number as the first parent commit"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index 1b649bba52..cf74df638b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -496,14 +496,17 @@ public abstract class Repository { if (!Character.isDigit(rev[l])) break; } - String distnum = new String(rev, i + 1, l - i - 1); int dist; - try { - dist = Integer.parseInt(distnum); - } catch (NumberFormatException e) { - throw new RevisionSyntaxException( - JGitText.get().invalidAncestryLength, revstr); - } + if (l - i > 1) { + String distnum = new String(rev, i + 1, l - i - 1); + try { + dist = Integer.parseInt(distnum); + } catch (NumberFormatException e) { + throw new RevisionSyntaxException( + JGitText.get().invalidAncestryLength, revstr); + } + } else + dist = 1; while (dist > 0) { RevCommit commit = (RevCommit) ref; if (commit.getParentCount() == 0) { |