mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
git: ignore changes that belong to another VCS root
GitOrigin-RevId: ea45ef61de4874135270b515b4a460fbd9cfbafe
This commit is contained in:
committed by
intellij-monorepo-bot
parent
67143dc458
commit
ea80a589e6
@@ -198,10 +198,20 @@ public class GitUntrackedFilesHolder implements Disposable, AsyncVfsEventsListen
|
||||
|
||||
Set<FilePath> untrackedFiles = myGit.untrackedFilePaths(myProject, myRoot, suspiciousFiles);
|
||||
|
||||
untrackedFiles.removeIf(it -> {
|
||||
VirtualFile root = myVcsManager.getVcsRootFor(it);
|
||||
if (!myRoot.equals(root)) {
|
||||
LOG.warn(String.format("Ignoring untracked file under another root: %s; root: %s; mapped root: %s", it, myRoot, root));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
synchronized (LOCK) {
|
||||
if (suspiciousFiles != null) {
|
||||
// files that were suspicious (and thus passed to 'git ls-files'), but are not untracked, are definitely tracked.
|
||||
myDefinitelyUntrackedFiles.removeIf((definitelyUntrackedFile)-> isUnder(myRootPath, suspiciousFiles, definitelyUntrackedFile));
|
||||
myDefinitelyUntrackedFiles.removeIf((definitelyUntrackedFile) -> isUnder(myRootPath, suspiciousFiles, definitelyUntrackedFile));
|
||||
myDefinitelyUntrackedFiles.addAll(untrackedFiles);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package git4idea.status;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -53,6 +54,8 @@ import java.util.*;
|
||||
* @author Kirill Likhodedov
|
||||
*/
|
||||
class GitChangesCollector {
|
||||
private static final Logger LOG = Logger.getInstance(GitChangesCollector.class);
|
||||
|
||||
@NotNull private final Project myProject;
|
||||
@NotNull private final Git myGit;
|
||||
@NotNull private final GitRepository myRepository;
|
||||
@@ -461,6 +464,15 @@ class GitChangesCollector {
|
||||
}
|
||||
|
||||
private void reportChange(FileStatus status, ContentRevision before, ContentRevision after) {
|
||||
myChanges.add(new Change(before, after, status));
|
||||
Change change = new Change(before, after, status);
|
||||
|
||||
FilePath filePath = ChangesUtil.getFilePath(change);
|
||||
VirtualFile root = ProjectLevelVcsManager.getInstance(myProject).getVcsRootFor(filePath);
|
||||
if (!myVcsRoot.equals(root)) {
|
||||
LOG.warn(String.format("Ignoring change under another root: %s; root: %s; mapped root: %s", change, myVcsRoot, root));
|
||||
return;
|
||||
}
|
||||
|
||||
myChanges.add(change);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user