Skip to content

Commit 5945954

Browse files
committed
refactor: remove support to search commits by committer
Signed-off-by: leo <longshuang@msn.cn>
1 parent a8ebfc3 commit 5945954

6 files changed

Lines changed: 18 additions & 26 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
namespace SourceGit.Commands
55
{
6-
public class QueryUsers : Command
6+
public class QueryAuthors : Command
77
{
8-
public QueryUsers(string repo)
8+
public QueryAuthors(string repo)
99
{
1010
WorkingDirectory = repo;
1111
Context = repo;
1212
RaiseError = false;
13-
Args = "log -100000 --all --format=%aN±%aE%n%cN±%cE";
13+
Args = "log -100000 --all --format=%aN±%aE";
1414
}
1515

1616
public async Task<List<Models.User>> GetResultAsync()

src/Commands/QueryCommits.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ public QueryCommits(string repo, string filter, Models.CommitSearchMethod method
2828
{
2929
builder.Append("-i --author=").Append(filter.Quoted());
3030
}
31-
else if (method == Models.CommitSearchMethod.ByCommitter)
32-
{
33-
builder.Append("-i --committer=").Append(filter.Quoted());
34-
}
3531
else if (method == Models.CommitSearchMethod.ByMessage)
3632
{
3733
var words = filter.Split([' ', '\t', '\r'], StringSplitOptions.RemoveEmptyEntries);

src/Models/Commit.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ public enum CommitSearchMethod
88
{
99
BySHA = 0,
1010
ByAuthor,
11-
ByCommitter,
1211
ByMessage,
1312
ByPath,
1413
ByContent,

src/Resources/Locales/en_US.axaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@
813813
<x:String x:Key="Text.Repository.Resolve" xml:space="preserve">RESOLVE</x:String>
814814
<x:String x:Key="Text.Repository.Search" xml:space="preserve">Search Commit</x:String>
815815
<x:String x:Key="Text.Repository.Search.ByAuthor" xml:space="preserve">Author</x:String>
816-
<x:String x:Key="Text.Repository.Search.ByCommitter" xml:space="preserve">Committer</x:String>
817816
<x:String x:Key="Text.Repository.Search.ByContent" xml:space="preserve">Content</x:String>
818817
<x:String x:Key="Text.Repository.Search.ByMessage" xml:space="preserve">Message</x:String>
819818
<x:String x:Key="Text.Repository.Search.ByPath" xml:space="preserve">Path</x:String>

src/ViewModels/SearchCommitContext.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public void EndSearch()
177177
_cancellation.Cancel();
178178

179179
_worktreeFiles = null;
180-
_users = null;
180+
_authors = null;
181181

182182
IsQuerying = false;
183183
Suggestions = null;
@@ -187,29 +187,28 @@ public void EndSearch()
187187

188188
private void UpdateSuggestions()
189189
{
190-
if (_method == (int)Models.CommitSearchMethod.ByAuthor ||
191-
_method == (int)Models.CommitSearchMethod.ByCommitter)
190+
if (_method == (int)Models.CommitSearchMethod.ByAuthor)
192191
{
193-
if (_users == null)
192+
if (_authors == null)
194193
{
195-
if (_requestingUsers)
194+
if (_requestingAuthors)
196195
return;
197196

198-
_requestingUsers = true;
197+
_requestingAuthors = true;
199198

200199
Task.Run(async () =>
201200
{
202-
var users = await new Commands.QueryUsers(_repo.FullPath)
201+
var authors = await new Commands.QueryAuthors(_repo.FullPath)
203202
.GetResultAsync()
204203
.ConfigureAwait(false);
205204

206205
Dispatcher.UIThread.Post(() =>
207206
{
208-
_requestingUsers = false;
207+
_requestingAuthors = false;
209208

210209
if (_repo.IsSearchingCommits)
211210
{
212-
_users = users;
211+
_authors = authors;
213212
UpdateSuggestions();
214213
}
215214
});
@@ -218,18 +217,18 @@ private void UpdateSuggestions()
218217
return;
219218
}
220219

221-
if (_users.Count == 0 || _filter.Length < 2)
220+
if (_authors.Count == 0 || _filter.Length < 2)
222221
{
223222
Suggestions = null;
224223
return;
225224
}
226225

227226
var matched = new List<object>();
228-
foreach (var user in _users)
227+
foreach (var author in _authors)
229228
{
230-
if (user.Name.Contains(_filter, StringComparison.OrdinalIgnoreCase) ||
231-
user.Email.Contains(_filter, StringComparison.OrdinalIgnoreCase))
232-
matched.Add(user);
229+
if (author.Name.Contains(_filter, StringComparison.OrdinalIgnoreCase) ||
230+
author.Email.Contains(_filter, StringComparison.OrdinalIgnoreCase))
231+
matched.Add(author);
233232
}
234233

235234
Suggestions = matched;
@@ -296,8 +295,8 @@ private void UpdateSuggestions()
296295
private Models.Commit _selected = null;
297296
private bool _requestingWorktreeFiles = false;
298297
private List<string> _worktreeFiles = null;
299-
private bool _requestingUsers = false;
300-
private List<Models.User> _users = null;
298+
private bool _requestingAuthors = false;
299+
private List<Models.User> _authors = null;
301300
private List<object> _suggestions = null;
302301
}
303302
}

src/Views/Repository.axaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@
612612
<ComboBox.Items>
613613
<TextBlock Text="{DynamicResource Text.Repository.Search.BySHA}"/>
614614
<TextBlock Text="{DynamicResource Text.Repository.Search.ByAuthor}"/>
615-
<TextBlock Text="{DynamicResource Text.Repository.Search.ByCommitter}"/>
616615
<TextBlock Text="{DynamicResource Text.Repository.Search.ByMessage}"/>
617616
<TextBlock Text="{DynamicResource Text.Repository.Search.ByPath}"/>
618617
<TextBlock Text="{DynamicResource Text.Repository.Search.ByContent}"/>

0 commit comments

Comments
 (0)