mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-61839 Git Log: Filter by branch: remotes/origin/HEAD -> origin/master doesn't work
This commit is contained in:
@@ -40,7 +40,7 @@ public class GitBranch extends GitReference {
|
||||
@NonNls public static final String REFS_REMOTES_PREFIX = "refs/remotes/"; // Prefix for remote branches ({@value})
|
||||
|
||||
private final boolean myRemote;
|
||||
private final boolean myActive;
|
||||
private boolean myActive;
|
||||
|
||||
public GitBranch(@NotNull String name, boolean active, boolean remote) {
|
||||
super(name);
|
||||
@@ -179,6 +179,7 @@ public class GitBranch extends GitReference {
|
||||
// origin/HEAD -> origin/master
|
||||
final String[] split = output.split("\n");
|
||||
GitBranch currentBranch = null;
|
||||
String activeRemoteName = null;
|
||||
for (String b : split) {
|
||||
boolean current = b.charAt(0) == '*';
|
||||
b = b.substring(2).trim();
|
||||
@@ -191,8 +192,15 @@ public class GitBranch extends GitReference {
|
||||
remotePrefix = REFS_REMOTES_PREFIX;
|
||||
}
|
||||
boolean isRemote = remotePrefix != null || remoteOnly;
|
||||
if (isRemote && !remoteOnly) {
|
||||
b = b.substring(remotePrefix.length());
|
||||
if (isRemote) {
|
||||
if (! remoteOnly) {
|
||||
b = b.substring(remotePrefix.length());
|
||||
}
|
||||
final int idx = b.indexOf("HEAD ->");
|
||||
if (idx > 0) {
|
||||
activeRemoteName = b.substring(idx + "HEAD ->".length() + remotePrefix.length());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
final GitBranch branch = new GitBranch(b, current, isRemote);
|
||||
if (current) {
|
||||
@@ -202,6 +210,14 @@ public class GitBranch extends GitReference {
|
||||
branches.add(branch);
|
||||
}
|
||||
}
|
||||
if (activeRemoteName != null) {
|
||||
for (GitBranch branch : branches) {
|
||||
if (activeRemoteName.equals(branch.getName())) {
|
||||
branch.setActive(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return currentBranch;
|
||||
}
|
||||
|
||||
@@ -294,4 +310,8 @@ public class GitBranch extends GitReference {
|
||||
return GitRevisionNumber.resolve(project, root, output);
|
||||
}
|
||||
}
|
||||
|
||||
public void setActive(boolean active) {
|
||||
myActive = active;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user