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>
This commit is contained in:
parent
570bba5e7a
commit
aa4bbc67b3
|
@ -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 static BranchTrackingStatus of(Repository repository, String branchName)
|
|||
if (tracking == null)
|
||||
return null;
|
||||
|
||||
Ref local = repository.getRef(branchName);
|
||||
Ref local = repository.getRef(fullBranchName);
|
||||
if (local == null)
|
||||
return null;
|
||||
|
||||
|
|
Loading…
Reference in New Issue