mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-80573 GitCheckoutOperation: sleep a bit to let file watcher report all changes for small repositories where refresh is too fast.
This commit is contained in:
@@ -231,8 +231,22 @@ class GitCheckoutOperation extends GitBranchOperation {
|
||||
|
||||
private static void refresh(GitRepository... repositories) {
|
||||
for (GitRepository repository : repositories) {
|
||||
// If repository is small, everything can happen so fast, that FileWatcher wouldn't report the change before refresh() handles it.
|
||||
// Performing a fair total refresh would be an overhead, so just waiting a bit to let file watcher report the change.
|
||||
// This is a hack, but other solutions would be either performance or programming overhead.
|
||||
// See http://youtrack.jetbrains.com/issue/IDEA-80573
|
||||
sleepABit();
|
||||
refreshRoot(repository);
|
||||
// repository state will be auto-updated with this VFS refresh => no need to call GitRepository#update().
|
||||
}
|
||||
}
|
||||
|
||||
private static void sleepABit() {
|
||||
try {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user