diff options
author | Robin Stocker <robin@nibor.org> | 2013-09-15 23:26:35 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2013-09-20 14:48:55 +0200 |
commit | aa4bbc67b3b18604681b6785e51aa018a7880fb1 (patch) | |
tree | 5336b87fe2c44307207083639c282d7fd6090ac6 | |
parent | 570bba5e7acb08df827655c31045bfe9cde9d856 (diff) | |
download | jgit-aa4bbc67b3b18604681b6785e51aa018a7880fb1.tar.gz jgit-aa4bbc67b3b18604681b6785e51aa018a7880fb1.zip |
Use full branch name when getting ref in BranchTrackingStatus
In case there is both a tag and branch called "foo", the tag is returned
if calling getRef with the short name. By using refs/heads/foo, the
branch is returned.
Bug: 417158
Change-Id: I86b4f83955586bb24774fd621f5012499cf67909
Signed-off-by: Robin Stocker <robin@nibor.org>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java index 7844fd819f..1525e5b187 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java @@ -70,8 +70,10 @@ public class BranchTrackingStatus { public static BranchTrackingStatus of(Repository repository, String branchName) throws IOException { + String shortBranchName = Repository.shortenRefName(branchName); + String fullBranchName = Constants.R_HEADS + shortBranchName; BranchConfig branchConfig = new BranchConfig(repository.getConfig(), - branchName); + shortBranchName); String trackingBranch = branchConfig.getTrackingBranch(); if (trackingBranch == null) @@ -81,7 +83,7 @@ public class BranchTrackingStatus { if (tracking == null) return null; - Ref local = repository.getRef(branchName); + Ref local = repository.getRef(fullBranchName); if (local == null) return null; |