mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Update repository state before waiting for the VFS refresh
It was initially intended to do so, but previously the VFS refresh
was asynchronous, so the order of refresh() and update() methods
was not important. However, in 32533a4 the VFS refresh became sync,
thus update() became executed after the whole VFS refresh (which makes
no sense).
This commit is contained in:
@@ -40,6 +40,7 @@ import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static git4idea.util.GitUIUtil.code;
|
||||
import static java.util.Arrays.stream;
|
||||
|
||||
/**
|
||||
* Represents {@code git checkout} operation.
|
||||
@@ -281,11 +282,11 @@ class GitCheckoutOperation extends GitBranchOperation {
|
||||
}
|
||||
|
||||
private void refresh(GitRepository... repositories) {
|
||||
// repositories state will be auto-updated with the following VFS refresh => there is no need to call GitRepository#update()
|
||||
// but we want repository state to be updated as soon as possible, without waiting for the whole VFS refresh to complete.
|
||||
stream(repositories).forEach(GitRepository::update);
|
||||
for (GitRepository repository : repositories) {
|
||||
refreshRoot(repository);
|
||||
// repository state will be auto-updated with this VFS refresh => in general there is no need to call GitRepository#update()
|
||||
// but to avoid problems of the asynchronous refresh, let's force update the repository info.
|
||||
repository.update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user