diff --git a/src/Commands/QueryCommits.cs b/src/Commands/QueryCommits.cs index 8a48eff3..76894412 100644 --- a/src/Commands/QueryCommits.cs +++ b/src/Commands/QueryCommits.cs @@ -14,21 +14,23 @@ namespace SourceGit.Commands _findFirstMerged = needFindHead; } - public QueryCommits(string repo, string filter, Models.CommitSearchMethod method) + public QueryCommits(string repo, string filter, Models.CommitSearchMethod method, bool onlyCurrentBranch) { - string search; + string search = onlyCurrentBranch ? string.Empty : "--branches --remotes "; if (method == Models.CommitSearchMethod.ByUser) { - search = $"-i --author=\"{filter}\" --committer=\"{filter}\""; + search += $"-i --author=\"{filter}\" --committer=\"{filter}\""; } else if (method == Models.CommitSearchMethod.ByFile) { - search = $"-- \"{filter}\""; + search += $"-- \"{filter}\""; } else { var argsBuilder = new StringBuilder(); + argsBuilder.Append(search); + var words = filter.Split(new[] { ' ', '\t', '\r' }, StringSplitOptions.RemoveEmptyEntries); foreach (var word in words) { @@ -36,12 +38,13 @@ namespace SourceGit.Commands argsBuilder.Append($"--grep=\"{escaped}\" "); } argsBuilder.Append("--all-match -i"); + search = argsBuilder.ToString(); } WorkingDirectory = repo; Context = repo; - Args = $"log -1000 --date-order --no-show-signature --decorate=full --pretty=format:%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s --branches --remotes " + search; + Args = $"log -1000 --date-order --no-show-signature --decorate=full --pretty=format:%H%n%P%n%D%n%aN±%aE%n%at%n%cN±%cE%n%ct%n%s " + search; _findFirstMerged = false; } diff --git a/src/Resources/Locales/de_DE.axaml b/src/Resources/Locales/de_DE.axaml index 0529ae68..7c0e2d10 100644 --- a/src/Resources/Locales/de_DE.axaml +++ b/src/Resources/Locales/de_DE.axaml @@ -512,7 +512,6 @@ REMOTE HINZUFÜGEN KONFLIKTE BEHEBEN Commit suchen - Suche über Dateiname Commit-Nachricht SHA diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index ad540c16..1d6563b9 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -509,11 +509,11 @@ ADD REMOTE RESOLVE Search Commit - Search By File Message SHA Author & Committer + Current Branch Show Tags as Tree Statistics SUBMODULES diff --git a/src/Resources/Locales/fr_FR.axaml b/src/Resources/Locales/fr_FR.axaml index 5464596c..9147da1a 100644 --- a/src/Resources/Locales/fr_FR.axaml +++ b/src/Resources/Locales/fr_FR.axaml @@ -491,7 +491,6 @@ ADD REMOTE RESOLVE Search Commit - Search By File Message SHA diff --git a/src/Resources/Locales/pt_BR.axaml b/src/Resources/Locales/pt_BR.axaml index 0eaf252f..b449c3ae 100644 --- a/src/Resources/Locales/pt_BR.axaml +++ b/src/Resources/Locales/pt_BR.axaml @@ -484,7 +484,6 @@ ADICIONAR REMOTO RESOLVER Pesquisar Commit - Pesquisar Por Arquivo Mensagem SHA diff --git a/src/Resources/Locales/ru_RU.axaml b/src/Resources/Locales/ru_RU.axaml index 18e64224..cee7d903 100644 --- a/src/Resources/Locales/ru_RU.axaml +++ b/src/Resources/Locales/ru_RU.axaml @@ -1,4 +1,7 @@ + + + О программе О SourceGit • Сборка с @@ -507,7 +510,6 @@ ДОБАВИТЬ ВНЕШНЕЕ ХРАНИЛИЩЕ РАЗРЕШИТЬ Поиск фиксации - Поиск по Файл Сообщение SHA diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 9c020f5b..7915cc53 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -507,11 +507,11 @@ 添加远程 解决冲突 查找提交 - 搜索途径 文件 提交信息 提交指纹 作者及提交者 + 仅在当前分支中查找 以树型结构展示 提交统计 子模块列表 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index a77db381..cb8fc19d 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -512,11 +512,11 @@ 新增遠端 解決衝突 搜尋提交 - 搜尋方式 檔案 提交訊息 提交編號 作者及提交者 + 僅搜尋當前分支 以樹型結構展示 提交統計 子模組列表 diff --git a/src/ViewModels/CommitDetail.cs b/src/ViewModels/CommitDetail.cs index 6021607e..3692be10 100644 --- a/src/ViewModels/CommitDetail.cs +++ b/src/ViewModels/CommitDetail.cs @@ -544,7 +544,8 @@ namespace SourceGit.ViewModels private void TryToAddContextMenuItemsForGitLFS(ContextMenu menu, string path) { var lfsEnabled = new Commands.LFS(_repo.FullPath).IsEnabled(); - if (!lfsEnabled) return; + if (!lfsEnabled) + return; var lfs = new MenuItem(); lfs.Header = App.Text("GitLFS"); diff --git a/src/ViewModels/Fetch.cs b/src/ViewModels/Fetch.cs index bf208193..e00669bf 100644 --- a/src/ViewModels/Fetch.cs +++ b/src/ViewModels/Fetch.cs @@ -65,7 +65,7 @@ namespace SourceGit.ViewModels CallUIThread(() => { _repo.MarkFetched(); - _repo.SetWatcherEnabled(true); + _repo.SetWatcherEnabled(true); }); return true; diff --git a/src/ViewModels/LFSLocks.cs b/src/ViewModels/LFSLocks.cs index 38dc2eb9..a09e7d1e 100644 --- a/src/ViewModels/LFSLocks.cs +++ b/src/ViewModels/LFSLocks.cs @@ -20,7 +20,7 @@ namespace SourceGit.ViewModels get => _isLoading; private set => SetProperty(ref _isLoading, value); } - + public bool ShowOnlyMyLocks { get => _showOnlyMyLocks; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index ec3e015d..0667c546 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -210,6 +210,12 @@ namespace SourceGit.ViewModels private set => SetProperty(ref _isSearchLoadingVisible, value); } + public bool OnlySearchCommitsInCurrentBranch + { + get => _onlySearchCommitsInCurrentBranch; + set => SetProperty(ref _onlySearchCommitsInCurrentBranch, value); + } + public int SearchCommitFilterType { get => _searchCommitFilterType; @@ -589,13 +595,13 @@ namespace SourceGit.ViewModels visible.Add(commit); break; case 1: - visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByUser).Result(); + visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByUser, _onlySearchCommitsInCurrentBranch).Result(); break; case 2: - visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByMessage).Result(); + visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByMessage, _onlySearchCommitsInCurrentBranch).Result(); break; case 3: - visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByFile).Result(); + visible = new Commands.QueryCommits(_fullpath, _searchCommitFilter, Models.CommitSearchMethod.ByFile, _onlySearchCommitsInCurrentBranch).Result(); break; } @@ -667,8 +673,8 @@ namespace SourceGit.ViewModels var hasLeft = false; foreach (var b in _branches) { - if (!b.FullName.Equals(local.FullName, StringComparison.Ordinal) && - !b.FullName.Equals(local.Upstream, StringComparison.Ordinal) && + if (!b.FullName.Equals(local.FullName, StringComparison.Ordinal) && + !b.FullName.Equals(local.Upstream, StringComparison.Ordinal) && !_settings.Filters.Contains(b.FullName)) { hasLeft = true; @@ -2072,6 +2078,7 @@ namespace SourceGit.ViewModels private bool _isSearchLoadingVisible = false; private bool _isSearchCommitSuggestionOpen = false; private int _searchCommitFilterType = 2; + private bool _onlySearchCommitsInCurrentBranch = false; private bool _enableFirstParentInHistories = false; private string _searchCommitFilter = string.Empty; private List _searchedCommits = new List(); diff --git a/src/Views/BranchTree.axaml.cs b/src/Views/BranchTree.axaml.cs index 2ff498b4..49d15ef0 100644 --- a/src/Views/BranchTree.axaml.cs +++ b/src/Views/BranchTree.axaml.cs @@ -430,7 +430,7 @@ namespace SourceGit.Views private void OnToggleFilterClicked(object sender, RoutedEventArgs e) { - if (DataContext is ViewModels.Repository repo && + if (DataContext is ViewModels.Repository repo && sender is ToggleButton toggle && toggle.DataContext is ViewModels.BranchTreeNode { Backend: Models.Branch branch } node) { diff --git a/src/Views/Repository.axaml b/src/Views/Repository.axaml index e8a0f424..786c8484 100644 --- a/src/Views/Repository.axaml +++ b/src/Views/Repository.axaml @@ -343,7 +343,7 @@ - + - - - - + @@ -450,9 +443,17 @@ - - + + + +