GitRebaseDialog: fix tracked branch selection

If the tracked branch was written in the short format, null was returned.
Just use this value, otherwise strip refs/heads prefix.
This commit is contained in:
Kirill Likhodedov
2012-11-01 14:23:30 +04:00
parent a8cd342fe3
commit 388c6e7d21
@@ -350,20 +350,19 @@ public class GitRebaseDialog extends DialogWrapper {
GitBranch trackedBranch = null;
if (currentBranch != null) {
String remote = GitConfigUtil.getValue(myProject, root, "branch." + currentBranch + ".remote");
String merge = GitConfigUtil.getValue(myProject, root, "branch." + currentBranch + ".merge");
String name =
(merge != null && merge.startsWith(GitBranch.REFS_HEADS_PREFIX)) ? merge.substring(GitBranch.REFS_HEADS_PREFIX.length()) : null;
if (remote == null || merge == null || name == null) {
String mergeBranch = GitConfigUtil.getValue(myProject, root, "branch." + currentBranch + ".merge");
if (remote == null || mergeBranch == null) {
trackedBranch = null;
}
else {
mergeBranch = GitBranchUtil.stripRefsPrefix(mergeBranch);
if (remote.equals(".")) {
trackedBranch = new GitSvnRemoteBranch(name, GitBranch.DUMMY_HASH);
trackedBranch = new GitSvnRemoteBranch(mergeBranch, GitBranch.DUMMY_HASH);
}
else {
GitRemote r = GitBranchUtil.findRemoteByNameOrLogError(myProject, root, remote);
if (r != null) {
trackedBranch = new GitStandardRemoteBranch(r, name, GitBranch.DUMMY_HASH);
trackedBranch = new GitStandardRemoteBranch(r, mergeBranch, GitBranch.DUMMY_HASH);
}
}
}