mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[git] IDEA-87709 Take files updated via git merge --ff-only into account and show them in the updated files info.
Caused by the fix for IDEA-87609.
This commit is contained in:
@@ -26,6 +26,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import git4idea.GitBranch;
|
||||
import git4idea.GitUtil;
|
||||
import git4idea.Notificator;
|
||||
import git4idea.PlatformFacade;
|
||||
import git4idea.branch.GitBranchPair;
|
||||
import git4idea.commands.*;
|
||||
@@ -170,6 +171,10 @@ public class GitRebaseUpdater extends GitUpdater {
|
||||
return "Rebase updater";
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to execute {@code git merge --ff-only}.
|
||||
* @return true, if everything is successful; false for any error (to let a usual "fair" update deal with it).
|
||||
*/
|
||||
public boolean fastForwardMerge() {
|
||||
LOG.info("Trying fast-forward merge for " + myRoot);
|
||||
GitRepository repository = GitUtil.getRepositoryManager(myProject).getRepositoryForRoot(myRoot);
|
||||
@@ -177,7 +182,28 @@ public class GitRebaseUpdater extends GitUpdater {
|
||||
LOG.error("Repository is null for " + myRoot);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
markStart(myRoot);
|
||||
}
|
||||
catch (VcsException e) {
|
||||
LOG.info("Couldn't mark start for repository " + myRoot, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
GitCommandResult result = myGit.merge(repository, getRemoteBranchToMerge(), Collections.singletonList("--ff-only"));
|
||||
|
||||
try {
|
||||
markEnd(myRoot);
|
||||
}
|
||||
catch (VcsException e) {
|
||||
// this is not critical, and update has already happened,
|
||||
// so we just notify the user about problems with collecting the updated changes.
|
||||
LOG.info("Couldn't mark end for repository " + myRoot, e);
|
||||
Notificator.getInstance(myProject).
|
||||
notifyWeakWarning("Couldn't collect the updated files info",
|
||||
String.format("Update of %s was successful, but we couldn't collect the updated changes because of an error",
|
||||
myRoot), null);
|
||||
}
|
||||
return result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -144,10 +144,15 @@ public class GitUpdateProcess {
|
||||
return GitUpdateResult.ERROR;
|
||||
}
|
||||
|
||||
if (updaters.isEmpty()) {
|
||||
return GitUpdateResult.NOTHING_TO_UPDATE;
|
||||
}
|
||||
|
||||
updaters = tryFastForwardMergeForRebaseUpdaters(updaters);
|
||||
|
||||
if (updaters.isEmpty()) {
|
||||
return GitUpdateResult.NOTHING_TO_UPDATE;
|
||||
// everything was updated via the fast-forward merge
|
||||
return GitUpdateResult.SUCCESS;
|
||||
}
|
||||
|
||||
// save local changes if needed (update via merge may perform without saving).
|
||||
|
||||
Reference in New Issue
Block a user