From ef221245a34b0f6799f7e321daff139754b8ece5 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Tue, 29 May 2018 20:38:52 +0300 Subject: [PATCH] git: don't show incorrect notification about "local changes not restored" Follow-up: 9d9c015 --- plugins/git4idea/src/git4idea/update/GitUpdateProcess.java | 6 +++++- .../git4idea/src/git4idea/util/GitPreservingProcess.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java index 4b2df75d76fb..d2a4108acbbe 100644 --- a/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java +++ b/plugins/git4idea/src/git4idea/update/GitUpdateProcess.java @@ -241,7 +241,11 @@ public class GitUpdateProcess { notifyImportantError(myProject, "Error updating " + rootName, "Updating " + rootName + " failed with an error: " + e.getLocalizedMessage()); } - }); + }) { + protected boolean shouldNotifyLocalChangesAreNotRestored() { + return unstashAfterUpdate(); + } + }; myPreservingProcess.execute(() -> { if (!unstashAfterUpdate()) return false; diff --git a/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java b/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java index c70e8c69ead1..b3e6e0152b7a 100644 --- a/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java +++ b/plugins/git4idea/src/git4idea/util/GitPreservingProcess.java @@ -100,7 +100,7 @@ public class GitPreservingProcess { LOG.debug("loading"); load(); } - else { + else if (shouldNotifyLocalChangesAreNotRestored()) { mySaver.notifyLocalChangesAreNotRestored(); } } @@ -111,6 +111,10 @@ public class GitPreservingProcess { new GitFreezingProcess(myProject, myOperationTitle, operation).execute(); } + protected boolean shouldNotifyLocalChangesAreNotRestored() { + return true; + } + /** * Configures the saver: i.e. notifications and texts for the GitConflictResolver used inside. */