mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 10:50:52 +08:00
fix(Checkout): never update repository when checkout failed.
This commit is contained in:
@@ -588,7 +588,17 @@ namespace SourceGit.Git {
|
||||
isWatcherDisabled = true;
|
||||
|
||||
var errs = RunCommand($"checkout {option}", null);
|
||||
AssertCommand(errs);
|
||||
if (errs != null) {
|
||||
App.RaiseError(errs);
|
||||
} else {
|
||||
Branches(true);
|
||||
OnBranchChanged?.Invoke();
|
||||
OnCommitsChanged?.Invoke();
|
||||
OnWorkingCopyChanged?.Invoke();
|
||||
OnTagChanged?.Invoke();
|
||||
}
|
||||
|
||||
isWatcherDisabled = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace SourceGit.UI {
|
||||
}
|
||||
|
||||
private void UpdateBranches(bool force = true) {
|
||||
bool IsDetached = false;
|
||||
bool isDetached = false;
|
||||
Git.Branch branch = null;
|
||||
Task.Run(() => {
|
||||
var branches = repo.Branches(force);
|
||||
@@ -238,7 +238,7 @@ namespace SourceGit.UI {
|
||||
} else {
|
||||
/// 对于 SUBMODULE HEAD 出于游离状态(detached on commit id)
|
||||
/// 此时,分支既不是 本地分支,也不是远程分支
|
||||
IsDetached = b.IsCurrent;
|
||||
isDetached = b.IsCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace SourceGit.UI {
|
||||
remoteBranchTree.ItemsSource = remoteNodes;
|
||||
});
|
||||
|
||||
if (IsDetached && branch != null) repo.Checkout(branch.Name);
|
||||
if (isDetached && branch != null) repo.Checkout(branch.Name);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user