mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-25 21:07:20 -08:00
enhance: histories filter
* set upstream branch using the same filter mode when change the filter mode of local branch * also excludes the decorators when current filter mode is excluding. Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
4796024483
commit
86d7541a7c
2 changed files with 8 additions and 22 deletions
|
@ -320,6 +320,8 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
builder.Append("--exclude=");
|
builder.Append("--exclude=");
|
||||||
builder.Append(b);
|
builder.Append(b);
|
||||||
|
builder.Append(" --decorate-refs-exclude=refs/heads/");
|
||||||
|
builder.Append(b);
|
||||||
builder.Append(' ');
|
builder.Append(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,6 +334,8 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
builder.Append("--exclude=");
|
builder.Append("--exclude=");
|
||||||
builder.Append(r);
|
builder.Append(r);
|
||||||
|
builder.Append(" --decorate-refs-exclude=refs/remotes/");
|
||||||
|
builder.Append(r);
|
||||||
builder.Append(' ');
|
builder.Append(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -344,6 +348,8 @@ namespace SourceGit.Models
|
||||||
{
|
{
|
||||||
builder.Append("--exclude=");
|
builder.Append("--exclude=");
|
||||||
builder.Append(t);
|
builder.Append(t);
|
||||||
|
builder.Append(" --decorate-refs-exclude=refs/tags/");
|
||||||
|
builder.Append(t);
|
||||||
builder.Append(' ');
|
builder.Append(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -724,28 +724,8 @@ namespace SourceGit.ViewModels
|
||||||
if (!changed)
|
if (!changed)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isLocal && !string.IsNullOrEmpty(branch.Upstream) && mode != Models.FilterMode.Excluded)
|
if (isLocal && !string.IsNullOrEmpty(branch.Upstream))
|
||||||
{
|
_settings.UpdateHistoriesFilter(branch.Upstream, Models.FilterType.RemoteBranch, mode);
|
||||||
var upstream = branch.Upstream;
|
|
||||||
var canUpdateUpstream = true;
|
|
||||||
foreach (var filter in _settings.HistoriesFilters)
|
|
||||||
{
|
|
||||||
bool matched = false;
|
|
||||||
if (filter.Type == Models.FilterType.RemoteBranch)
|
|
||||||
matched = filter.Pattern.Equals(upstream, StringComparison.Ordinal);
|
|
||||||
else if (filter.Type == Models.FilterType.RemoteBranchFolder)
|
|
||||||
matched = upstream.StartsWith(filter.Pattern, StringComparison.Ordinal);
|
|
||||||
|
|
||||||
if (matched && filter.Mode == Models.FilterMode.Excluded)
|
|
||||||
{
|
|
||||||
canUpdateUpstream = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (canUpdateUpstream)
|
|
||||||
_settings.UpdateHistoriesFilter(upstream, Models.FilterType.RemoteBranch, mode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue