Commit 1d6a2d3c authored by Kirill Likhodedov's avatar Kirill Likhodedov Committed by intellij-monorepo-bot
Browse files

git: after stashing, refresh the VFS within the same background process: EA-210543

GitOrigin-RevId: 9693c99042883c3ee97eec81aa5ac7549588c17b
parent 4a39c52c
Showing with 7 additions and 22 deletions
+7 -22
......@@ -18,20 +18,11 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Git stash action
*/
public class GitStash extends GitRepositoryAction {
/**
* {@inheritDoc}
*/
@Override
protected void perform(@NotNull final Project project,
@NotNull final List<VirtualFile> gitRoots,
@NotNull final VirtualFile defaultRoot) {
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
if (changeListManager.isFreezedWithNotification("Can not stash changes now")) return;
protected void perform(@NotNull Project project, @NotNull List<VirtualFile> gitRoots, @NotNull VirtualFile defaultRoot) {
if (ChangeListManager.getInstance(project).isFreezedWithNotification("Can not stash changes now")) return;
GitStashDialog d = new GitStashDialog(project, gitRoots, defaultRoot);
if (!d.showAndGet()) {
return;
......@@ -42,23 +33,17 @@ public class GitStash extends GitRepositoryAction {
public void run(@NotNull ProgressIndicator indicator) {
try (AccessToken ignored = DvcsUtil.workingTreeChangeStarted(project, getActionName())) {
GitCommandResult result = Git.getInstance().runCommand(d.handler());
if (!result.success()) {
VcsNotifier.getInstance(project).notifyError(GitBundle.getString("stashing.title"),
result.getErrorOutputAsHtmlString());
if (result.success()) {
VfsUtil.markDirtyAndRefresh(false, true, false, d.getGitRoot());
}
else {
VcsNotifier.getInstance(project).notifyError("Stash Failed", result.getErrorOutputAsHtmlString());
}
}
}
@Override
public void onFinished() {
VfsUtil.markDirtyAndRefresh(false, true, false, d.getGitRoot());
}
}.queue();
}
/**
* {@inheritDoc}
*/
@Override
@NotNull
protected String getActionName() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment