mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
GitCompareWithBranchAction: fix the title of the current revision
Display current branch name (or short hash), not the full hash.
This commit is contained in:
@@ -66,13 +66,20 @@ public class GitCompareWithBranchAction extends DumbAwareAction {
|
||||
final VirtualFile file = getAffectedFile(event);
|
||||
|
||||
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
|
||||
if (manager == null) {
|
||||
return;
|
||||
}
|
||||
GitRepository repository = manager.getRepositoryForFile(file);
|
||||
assert repository != null;
|
||||
|
||||
final String head = repository.getCurrentRevision();
|
||||
GitBranch currentBranch = repository.getCurrentBranch();
|
||||
final String head;
|
||||
if (currentBranch == null) {
|
||||
String currentRevision = repository.getCurrentRevision();
|
||||
LOG.assertTrue(currentRevision != null,
|
||||
"Current revision is null for " + repository + ". Compare with branch shouldn't be available for fresh repository");
|
||||
head = GitUtil.getShortHash(currentRevision);
|
||||
}
|
||||
else {
|
||||
head = currentBranch.getName();
|
||||
}
|
||||
final List<String> branchNames = getBranchNamesExceptCurrent(repository);
|
||||
|
||||
// prepare and invoke popup
|
||||
@@ -132,11 +139,6 @@ public class GitCompareWithBranchAction extends DumbAwareAction {
|
||||
}
|
||||
|
||||
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
|
||||
if (manager == null) {
|
||||
presentation.setEnabled(false);
|
||||
presentation.setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
GitRepository repository = manager.getRepositoryForFile(vFiles[0]);
|
||||
if (repository == null || repository.isFresh() || noBranchesToCompare(repository)) {
|
||||
|
||||
Reference in New Issue
Block a user