Skip to content

Commit 6dd540b

Browse files
committed
refactor: Models.CommitCheckPassed is unnecessary in async mode
Signed-off-by: leo <[email protected]>
1 parent 6f24d66 commit 6dd540b

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

src/Models/Commit.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ public enum CommitSearchMethod
1616
ByContent,
1717
}
1818

19-
public enum CommitCheckPassed
20-
{
21-
None = 0,
22-
DetachedHead,
23-
Filter,
24-
FileCount,
25-
}
26-
2719
public class Commit
2820
{
2921
// As retrieved by: git mktree </dev/null

src/ViewModels/WorkingCopy.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ public async Task ClearCommitMessageHistoryAsync()
625625
_repo.Settings.CommitMessages.Clear();
626626
}
627627

628-
public async Task CommitAsync(bool autoStage, bool autoPush, Models.CommitCheckPassed checkPassed = Models.CommitCheckPassed.None)
628+
public async Task CommitAsync(bool autoStage, bool autoPush)
629629
{
630630
if (string.IsNullOrWhiteSpace(_commitMessage))
631631
return;
@@ -642,25 +642,23 @@ public async Task CommitAsync(bool autoStage, bool autoPush, Models.CommitCheckP
642642
return;
643643
}
644644

645-
if (_repo.CurrentBranch is { IsDetachedHead: true } && checkPassed < Models.CommitCheckPassed.DetachedHead)
645+
if (_repo.CurrentBranch is { IsDetachedHead: true })
646646
{
647647
var msg = App.Text("WorkingCopy.ConfirmCommitWithDetachedHead");
648648
var sure = await App.AskConfirmAsync(msg);
649-
if (sure)
650-
await CommitAsync(autoStage, autoPush, Models.CommitCheckPassed.DetachedHead);
651-
return;
649+
if (!sure)
650+
return;
652651
}
653652

654-
if (!string.IsNullOrEmpty(_filter) && _staged.Count > _visibleStaged.Count && checkPassed < Models.CommitCheckPassed.Filter)
653+
if (!string.IsNullOrEmpty(_filter) && _staged.Count > _visibleStaged.Count)
655654
{
656655
var msg = App.Text("WorkingCopy.ConfirmCommitWithFilter", _staged.Count, _visibleStaged.Count, _staged.Count - _visibleStaged.Count);
657656
var sure = await App.AskConfirmAsync(msg);
658-
if (sure)
659-
await CommitAsync(autoStage, autoPush, Models.CommitCheckPassed.Filter);
660-
return;
657+
if (!sure)
658+
return;
661659
}
662660

663-
if (checkPassed < Models.CommitCheckPassed.FileCount && !_useAmend)
661+
if (!_useAmend)
664662
{
665663
if ((!autoStage && _staged.Count == 0) || (autoStage && _cached.Count == 0))
666664
{

0 commit comments

Comments
 (0)