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:
Kirill Likhodedov
2012-02-20 13:42:18 +04:00
parent 5825efe2e3
commit b3bab12e61
@@ -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);
}
}
}