Skip to content

Commit 69a09fa

Browse files
committed
Remove leftover braces and reformat
1 parent 4423579 commit 69a09fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+813
-935
lines changed

src/ViewModels/AddRemote.cs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,21 @@ public override async Task<bool> Sure()
9595
var log = _repo.CreateLog("Add Remote");
9696
Use(log);
9797

98+
var succ = await new Commands.Remote(_repo.FullPath).Use(log).AddAsync(_name, _url);
99+
if (succ)
98100
{
99-
var succ = await new Commands.Remote(_repo.FullPath).Use(log).AddAsync(_name, _url);
100-
if (succ)
101-
{
102-
await new Commands.Config(_repo.FullPath).Use(log).SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
103-
await new Commands.Fetch(_repo.FullPath, _name, false, false).Use(log).ExecAsync();
104-
}
105-
106-
log.Complete();
107-
await CallUIThreadAsync(() =>
108-
{
109-
_repo.MarkFetched();
110-
_repo.MarkBranchesDirtyManually();
111-
_repo.SetWatcherEnabled(true);
112-
});
113-
return succ;
101+
await new Commands.Config(_repo.FullPath).Use(log).SetAsync($"remote.{_name}.sshkey", _useSSH ? SSHKey : null);
102+
await new Commands.Fetch(_repo.FullPath, _name, false, false).Use(log).ExecAsync();
114103
}
104+
105+
log.Complete();
106+
await CallUIThreadAsync(() =>
107+
{
108+
_repo.MarkFetched();
109+
_repo.MarkBranchesDirtyManually();
110+
_repo.SetWatcherEnabled(true);
111+
});
112+
return succ;
115113
}
116114

117115
private readonly Repository _repo = null;

src/ViewModels/AddSubmodule.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,11 @@ public override async Task<bool> Sure()
5959
relativePath = Path.GetFileName(_url);
6060
}
6161

62-
{
63-
var succ = await new Commands.Submodule(_repo.FullPath).Use(log).AddAsync(_url, relativePath, Recursive);
64-
log.Complete();
62+
var succ = await new Commands.Submodule(_repo.FullPath).Use(log).AddAsync(_url, relativePath, Recursive);
63+
log.Complete();
6564

66-
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
67-
return succ;
68-
}
65+
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
66+
return succ;
6967
}
7068

7169
private readonly Repository _repo = null;

src/ViewModels/AddToIgnore.cs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,27 @@ public override async Task<bool> Sure()
3232
_repo.SetWatcherEnabled(false);
3333
ProgressDescription = "Adding Ignored File(s) ...";
3434

35+
var file = StorageFile.GetFullPath(_repo.FullPath, _repo.GitDir);
36+
if (!File.Exists(file))
3537
{
36-
var file = StorageFile.GetFullPath(_repo.FullPath, _repo.GitDir);
37-
if (!File.Exists(file))
38-
{
39-
await File.WriteAllLinesAsync(file, [_pattern]);
40-
}
38+
await File.WriteAllLinesAsync(file, [_pattern]);
39+
}
40+
else
41+
{
42+
var org = await File.ReadAllTextAsync(file);
43+
if (!org.EndsWith('\n'))
44+
await File.AppendAllLinesAsync(file, ["", _pattern]);
4145
else
42-
{
43-
var org = await File.ReadAllTextAsync(file);
44-
if (!org.EndsWith('\n'))
45-
await File.AppendAllLinesAsync(file, ["", _pattern]);
46-
else
47-
await File.AppendAllLinesAsync(file, [_pattern]);
48-
}
49-
50-
await CallUIThreadAsync(() =>
51-
{
52-
_repo.MarkWorkingCopyDirtyManually();
53-
_repo.SetWatcherEnabled(true);
54-
});
55-
56-
return true;
46+
await File.AppendAllLinesAsync(file, [_pattern]);
5747
}
48+
49+
await CallUIThreadAsync(() =>
50+
{
51+
_repo.MarkWorkingCopyDirtyManually();
52+
_repo.SetWatcherEnabled(true);
53+
});
54+
55+
return true;
5856
}
5957

6058
private readonly Repository _repo;

src/ViewModels/AddWorktree.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,11 @@ public override async Task<bool> Sure()
116116

117117
Use(log);
118118

119-
{
120-
var succ = await new Commands.Worktree(_repo.FullPath).Use(log).AddAsync(_path, branchName, _createNewBranch, tracking);
121-
log.Complete();
119+
var succ = await new Commands.Worktree(_repo.FullPath).Use(log).AddAsync(_path, branchName, _createNewBranch, tracking);
120+
log.Complete();
122121

123-
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
124-
return succ;
125-
}
122+
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
123+
return succ;
126124
}
127125

128126
private Repository _repo = null;

src/ViewModels/Apply.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,11 @@ public override async Task<bool> Sure()
4747
ProgressDescription = "Apply patch...";
4848

4949
var log = _repo.CreateLog("Apply Patch");
50-
{
51-
var succ = await new Commands.Apply(_repo.FullPath, _patchFile, _ignoreWhiteSpace, SelectedWhiteSpaceMode.Arg, null).Use(log).ExecAsync();
52-
log.Complete();
50+
var succ = await new Commands.Apply(_repo.FullPath, _patchFile, _ignoreWhiteSpace, SelectedWhiteSpaceMode.Arg, null).Use(log).ExecAsync();
51+
log.Complete();
5352

54-
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
55-
return succ;
56-
}
53+
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
54+
return succ;
5755
}
5856

5957
private readonly Repository _repo = null;

src/ViewModels/ApplyStash.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,12 @@ public override async Task<bool> Sure()
3333
ProgressDescription = $"Applying stash: {Stash.Name}";
3434

3535
var log = _repo.CreateLog("Apply Stash");
36-
{
37-
var succ = await new Commands.Stash(_repo.FullPath).Use(log).ApplyAsync(Stash.Name, RestoreIndex);
38-
if (succ && DropAfterApply)
39-
await new Commands.Stash(_repo.FullPath).Use(log).DropAsync(Stash.Name);
40-
41-
log.Complete();
42-
return true;
43-
}
36+
var succ = await new Commands.Stash(_repo.FullPath).Use(log).ApplyAsync(Stash.Name, RestoreIndex);
37+
if (succ && DropAfterApply)
38+
await new Commands.Stash(_repo.FullPath).Use(log).DropAsync(Stash.Name);
39+
40+
log.Complete();
41+
return true;
4442
}
4543

4644
private readonly Repository _repo;

src/ViewModels/Archive.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,17 @@ public override async Task<bool> Sure()
5252
var log = _repo.CreateLog("Archive");
5353
Use(log);
5454

55-
{
56-
var succ = await new Commands.Archive(_repo.FullPath, _revision, _saveFile).Use(log).ExecAsync();
57-
log.Complete();
55+
var succ = await new Commands.Archive(_repo.FullPath, _revision, _saveFile).Use(log).ExecAsync();
56+
log.Complete();
5857

59-
await CallUIThreadAsync(() =>
60-
{
61-
_repo.SetWatcherEnabled(true);
62-
if (succ)
63-
App.SendNotification(_repo.FullPath, $"Save archive to : {_saveFile}");
64-
});
58+
await CallUIThreadAsync(() =>
59+
{
60+
_repo.SetWatcherEnabled(true);
61+
if (succ)
62+
App.SendNotification(_repo.FullPath, $"Save archive to : {_saveFile}");
63+
});
6564

66-
return succ;
67-
}
65+
return succ;
6866
}
6967

7068
private readonly Repository _repo = null;

src/ViewModels/Checkout.cs

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -42,69 +42,67 @@ public override async Task<bool> Sure()
4242
Use(log);
4343

4444
var updateSubmodules = IsRecurseSubmoduleVisible && RecurseSubmodules;
45-
{
46-
bool succ;
47-
var needPopStash = false;
45+
bool succ;
46+
var needPopStash = false;
4847

49-
if (!_repo.ConfirmCheckoutBranch())
50-
{
51-
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
52-
return true;
53-
}
48+
if (!_repo.ConfirmCheckoutBranch())
49+
{
50+
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
51+
return true;
52+
}
5453

55-
if (DiscardLocalChanges)
56-
{
57-
succ = await new Commands.Checkout(_repo.FullPath).Use(log).BranchAsync(Branch, true);
58-
}
59-
else
54+
if (DiscardLocalChanges)
55+
{
56+
succ = await new Commands.Checkout(_repo.FullPath).Use(log).BranchAsync(Branch, true);
57+
}
58+
else
59+
{
60+
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).ResultAsync();
61+
if (changes > 0)
6062
{
61-
var changes = await new Commands.CountLocalChangesWithoutUntracked(_repo.FullPath).ResultAsync();
62-
if (changes > 0)
63+
succ = await new Commands.Stash(_repo.FullPath).Use(log).PushAsync("CHECKOUT_AUTO_STASH");
64+
if (!succ)
6365
{
64-
succ = await new Commands.Stash(_repo.FullPath).Use(log).PushAsync("CHECKOUT_AUTO_STASH");
65-
if (!succ)
66-
{
67-
log.Complete();
68-
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
69-
return false;
70-
}
71-
72-
needPopStash = true;
66+
log.Complete();
67+
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
68+
return false;
7369
}
7470

75-
succ = await new Commands.Checkout(_repo.FullPath).Use(log).BranchAsync(Branch, false);
71+
needPopStash = true;
7672
}
7773

78-
if (succ)
79-
{
80-
if (updateSubmodules)
81-
{
82-
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).ResultAsync();
83-
if (submodules.Count > 0)
84-
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules, true, true);
85-
}
74+
succ = await new Commands.Checkout(_repo.FullPath).Use(log).BranchAsync(Branch, false);
75+
}
8676

87-
if (needPopStash)
88-
await new Commands.Stash(_repo.FullPath).Use(log).PopAsync("stash@{0}");
77+
if (succ)
78+
{
79+
if (updateSubmodules)
80+
{
81+
var submodules = await new Commands.QueryUpdatableSubmodules(_repo.FullPath).ResultAsync();
82+
if (submodules.Count > 0)
83+
await new Commands.Submodule(_repo.FullPath).Use(log).UpdateAsync(submodules, true, true);
8984
}
9085

91-
log.Complete();
86+
if (needPopStash)
87+
await new Commands.Stash(_repo.FullPath).Use(log).PopAsync("stash@{0}");
88+
}
9289

93-
await CallUIThreadAsync(() =>
94-
{
95-
ProgressDescription = "Waiting for branch updated...";
90+
log.Complete();
9691

97-
var b = _repo.Branches.Find(x => x.IsLocal && x.Name == Branch);
98-
if (b != null && _repo.HistoriesFilterMode == Models.FilterMode.Included)
99-
_repo.SetBranchFilterMode(b, Models.FilterMode.Included, true, false);
92+
await CallUIThreadAsync(() =>
93+
{
94+
ProgressDescription = "Waiting for branch updated...";
10095

101-
_repo.MarkBranchesDirtyManually();
102-
_repo.SetWatcherEnabled(true);
103-
});
96+
var b = _repo.Branches.Find(x => x.IsLocal && x.Name == Branch);
97+
if (b != null && _repo.HistoriesFilterMode == Models.FilterMode.Included)
98+
_repo.SetBranchFilterMode(b, Models.FilterMode.Included, true, false);
10499

105-
Task.Delay(400).Wait();
106-
return succ;
107-
}
100+
_repo.MarkBranchesDirtyManually();
101+
_repo.SetWatcherEnabled(true);
102+
});
103+
104+
Task.Delay(400).Wait();
105+
return succ;
108106
}
109107

110108
private readonly Repository _repo = null;

0 commit comments

Comments
 (0)