Skip to content

Commit 1d38c9d

Browse files
committed
enhance: start checkout directly when there is no local changes but submodules
Signed-off-by: leo <longshuang@msn.cn>
1 parent 1e5be96 commit 1d38c9d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ViewModels/Checkout.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public Checkout(Repository repo, string branch)
2222
DiscardLocalChanges = false;
2323
}
2424

25+
public override bool CanStartDirectly()
26+
{
27+
return _repo.LocalChangesCount == 0;
28+
}
29+
2530
public override async Task<bool> Sure()
2631
{
2732
using var lockWatcher = _repo.LockWatcher();

src/ViewModels/Repository.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,10 +1317,7 @@ public async Task CheckoutBranchAsync(Models.Branch branch)
13171317

13181318
if (branch.IsLocal)
13191319
{
1320-
if (_localChangesCount > 0 || _submodules.Count > 0)
1321-
ShowPopup(new Checkout(this, branch.Name));
1322-
else
1323-
await ShowAndStartPopupAsync(new Checkout(this, branch.Name));
1320+
await ShowAndStartPopupAsync(new Checkout(this, branch.Name));
13241321
}
13251322
else
13261323
{

0 commit comments

Comments
 (0)