mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-122034 - assert: GitDeleteTagOperation.lambda$new$
Do not try to delete tag, if we failed to read its hash.
This commit is contained in:
@@ -8,12 +8,11 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.VcsNotifier;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import git4idea.GitRevisionNumber;
|
||||
import git4idea.GitTag;
|
||||
import git4idea.GitUtil;
|
||||
import git4idea.commands.Git;
|
||||
import git4idea.commands.GitCommandResult;
|
||||
import git4idea.commands.GitCompoundResult;
|
||||
@@ -21,6 +20,7 @@ import git4idea.repo.GitRepository;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.openapi.vcs.VcsNotifier.STANDARD_NOTIFICATION;
|
||||
@@ -37,27 +37,32 @@ class GitDeleteTagOperation extends GitBranchOperation {
|
||||
@NotNull private final String myTagName;
|
||||
@NotNull private final VcsNotifier myNotifier;
|
||||
|
||||
@NotNull private final Map<GitRepository, String> myDeletedTagTips;
|
||||
@NotNull private final Map<GitRepository, String> myDeletedTagTips = new HashMap<>();
|
||||
|
||||
GitDeleteTagOperation(@NotNull Project project, @NotNull Git git, @NotNull GitBranchUiHandler uiHandler,
|
||||
@NotNull Collection<GitRepository> repositories, @NotNull String tagName) {
|
||||
super(project, git, uiHandler, repositories);
|
||||
myTagName = tagName;
|
||||
myNotifier = VcsNotifier.getInstance(myProject);
|
||||
myDeletedTagTips = ContainerUtil.map2MapNotNull(repositories, (GitRepository repo) -> {
|
||||
try {
|
||||
GitRevisionNumber revisionNumber = GitRevisionNumber.resolve(myProject, repo.getRoot(), GitTag.REFS_TAGS_PREFIX + tagName);
|
||||
return Pair.create(repo, revisionNumber.asString());
|
||||
}
|
||||
catch (VcsException e) {
|
||||
LOG.error("Couldn't find hash for tag " + myTagName + " in " + repo);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
for (GitRepository repository: getRepositories()) {
|
||||
try {
|
||||
GitRevisionNumber revisionNumber = GitRevisionNumber.resolve(myProject, repository.getRoot(), GitTag.REFS_TAGS_PREFIX + myTagName);
|
||||
myDeletedTagTips.put(repository, revisionNumber.asString());
|
||||
}
|
||||
catch (VcsException e) {
|
||||
String title = "Couldn't find tag " + myTagName;
|
||||
if (!GitUtil.justOneGitRepository(myProject)) {
|
||||
title += " in " + repository.getPresentableUrl();
|
||||
}
|
||||
fatalError(title, "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
while (hasMoreRepositories()) {
|
||||
GitRepository repository = next();
|
||||
GitCommandResult result = myGit.deleteTag(repository, myTagName);
|
||||
|
||||
Reference in New Issue
Block a user