mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
fix(Checkout): never update repository when checkout failed.
This commit is contained in:
parent
8bc23a7d71
commit
fa1a86b7ac
2 changed files with 14 additions and 4 deletions
|
@ -588,7 +588,17 @@ namespace SourceGit.Git {
|
||||||
isWatcherDisabled = true;
|
isWatcherDisabled = true;
|
||||||
|
|
||||||
var errs = RunCommand($"checkout {option}", null);
|
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>
|
/// <summary>
|
||||||
|
|
|
@ -196,7 +196,7 @@ namespace SourceGit.UI {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateBranches(bool force = true) {
|
private void UpdateBranches(bool force = true) {
|
||||||
bool IsDetached = false;
|
bool isDetached = false;
|
||||||
Git.Branch branch = null;
|
Git.Branch branch = null;
|
||||||
Task.Run(() => {
|
Task.Run(() => {
|
||||||
var branches = repo.Branches(force);
|
var branches = repo.Branches(force);
|
||||||
|
@ -238,7 +238,7 @@ namespace SourceGit.UI {
|
||||||
} else {
|
} else {
|
||||||
/// 对于 SUBMODULE HEAD 出于游离状态(detached on commit id)
|
/// 对于 SUBMODULE HEAD 出于游离状态(detached on commit id)
|
||||||
/// 此时,分支既不是 本地分支,也不是远程分支
|
/// 此时,分支既不是 本地分支,也不是远程分支
|
||||||
IsDetached = b.IsCurrent;
|
isDetached = b.IsCurrent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ namespace SourceGit.UI {
|
||||||
remoteBranchTree.ItemsSource = remoteNodes;
|
remoteBranchTree.ItemsSource = remoteNodes;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (IsDetached && branch != null) repo.Checkout(branch.Name);
|
if (isDetached && branch != null) repo.Checkout(branch.Name);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue