code_style: run dotnet format

This commit is contained in:
leo 2024-07-31 16:26:58 +08:00
parent 2e87f83a38
commit ec6fe25e87
No known key found for this signature in database
10 changed files with 13 additions and 33 deletions

View file

@ -6,7 +6,6 @@ namespace SourceGit.Commands
{ {
public partial class Blame : Command public partial class Blame : Command
{ {
[GeneratedRegex(@"^\^?([0-9a-f]+)\s+.*\((.*)\s+(\d+)\s+[\-\+]?\d+\s+\d+\) (.*)")] [GeneratedRegex(@"^\^?([0-9a-f]+)\s+.*\((.*)\s+(\d+)\s+[\-\+]?\d+\s+\d+\) (.*)")]
private static partial Regex REG_FORMAT(); private static partial Regex REG_FORMAT();

View file

@ -50,24 +50,16 @@ namespace SourceGit.Commands
if (!allowEmpty && string.IsNullOrWhiteSpace(value)) if (!allowEmpty && string.IsNullOrWhiteSpace(value))
{ {
if (string.IsNullOrEmpty(WorkingDirectory)) if (string.IsNullOrEmpty(WorkingDirectory))
{
Args = $"config --global --unset {key}"; Args = $"config --global --unset {key}";
}
else else
{
Args = $"config --unset {key}"; Args = $"config --unset {key}";
}
} }
else else
{ {
if (string.IsNullOrWhiteSpace(WorkingDirectory)) if (string.IsNullOrWhiteSpace(WorkingDirectory))
{
Args = $"config --global {key} \"{value}\""; Args = $"config --global {key} \"{value}\"";
}
else else
{
Args = $"config {key} \"{value}\""; Args = $"config {key} \"{value}\"";
}
} }
return Exec(); return Exec();

View file

@ -38,13 +38,9 @@ namespace SourceGit.Commands
ProcessInlineHighlights(); ProcessInlineHighlights();
if (_result.TextDiff.Lines.Count == 0) if (_result.TextDiff.Lines.Count == 0)
{
_result.TextDiff = null; _result.TextDiff = null;
}
else else
{
_result.TextDiff.MaxLineNumber = Math.Max(_newLine, _oldLine); _result.TextDiff.MaxLineNumber = Math.Max(_newLine, _oldLine);
}
} }
return _result; return _result;

View file

@ -10,11 +10,5 @@
Context = repo; Context = repo;
Args = $"diff -a --ignore-cr-at-eol --check {opt}"; Args = $"diff -a --ignore-cr-at-eol --check {opt}";
} }
public bool Result()
{
var rs = ReadToEnd();
return rs.IsSuccess;
}
} }
} }

View file

@ -30,7 +30,8 @@ namespace SourceGit.Commands
var match = REG_FORMAT2().Match(line); var match = REG_FORMAT2().Match(line);
if (match.Success) if (match.Success)
{ {
var change = new Models.Change() { var change = new Models.Change()
{
Path = match.Groups[3].Value, Path = match.Groups[3].Value,
DataForAmend = new Models.ChangeDataForAmend() DataForAmend = new Models.ChangeDataForAmend()
{ {
@ -46,7 +47,8 @@ namespace SourceGit.Commands
match = REG_FORMAT1().Match(line); match = REG_FORMAT1().Match(line);
if (match.Success) if (match.Success)
{ {
var change = new Models.Change() { var change = new Models.Change()
{
Path = match.Groups[4].Value, Path = match.Groups[4].Value,
DataForAmend = new Models.ChangeDataForAmend() DataForAmend = new Models.ChangeDataForAmend()
{ {

View file

@ -58,7 +58,7 @@ namespace SourceGit.ViewModels
get => _repo.Settings.PreferRebaseInsteadOfMerge; get => _repo.Settings.PreferRebaseInsteadOfMerge;
set => _repo.Settings.PreferRebaseInsteadOfMerge = value; set => _repo.Settings.PreferRebaseInsteadOfMerge = value;
} }
public bool FetchAllBranches public bool FetchAllBranches
{ {
get => _repo.Settings.FetchAllBranchesOnPull; get => _repo.Settings.FetchAllBranchesOnPull;

View file

@ -207,8 +207,8 @@ namespace SourceGit.ViewModels
{ {
if (SetProperty(ref _searchCommitFilter, value) && if (SetProperty(ref _searchCommitFilter, value) &&
_searchCommitFilterType == 3 && _searchCommitFilterType == 3 &&
!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(value) &&
value.Length >= 2 && value.Length >= 2 &&
_revisionFiles.Count > 0) _revisionFiles.Count > 0)
{ {
var suggestion = new List<string>(); var suggestion = new List<string>();

View file

@ -23,11 +23,8 @@ namespace SourceGit.ViewModels
{ {
Task.Run(() => Task.Run(() =>
{ {
var result = new Commands.IsConflictResolved(repo, change).Result(); var result = new Commands.IsConflictResolved(repo, change).ReadToEnd().IsSuccess;
Dispatcher.UIThread.Post(() => Dispatcher.UIThread.Post(() => IsResolved = result);
{
IsResolved = result;
});
}); });
} }

View file

@ -415,7 +415,7 @@ namespace SourceGit.Views
{ {
if (DataContext is ViewModels.Histories histories && sender is DataGrid datagrid && datagrid.SelectedItems is { Count: 1 } selectedItems) if (DataContext is ViewModels.Histories histories && sender is DataGrid datagrid && datagrid.SelectedItems is { Count: 1 } selectedItems)
{ {
histories.DoubleTapped(selectedItems[0] as Models.Commit); histories.DoubleTapped(selectedItems[0] as Models.Commit);
} }
e.Handled = true; e.Handled = true;
} }

View file

@ -44,7 +44,7 @@ namespace SourceGit.Views
SearchSuggestionBox.Focus(NavigationMethod.Tab); SearchSuggestionBox.Focus(NavigationMethod.Tab);
SearchSuggestionBox.SelectedIndex = 0; SearchSuggestionBox.SelectedIndex = 0;
} }
e.Handled = true; e.Handled = true;
} }
@ -295,7 +295,7 @@ namespace SourceGit.Views
} }
} }
private void OnSearchSuggestionBoxKeyDown(object sender, KeyEventArgs e) private void OnSearchSuggestionBoxKeyDown(object sender, KeyEventArgs e)
{ {
var repo = DataContext as ViewModels.Repository; var repo = DataContext as ViewModels.Repository;
if (e.Key == Key.Escape) if (e.Key == Key.Escape)
@ -314,7 +314,7 @@ namespace SourceGit.Views
} }
} }
private void OnSearchSuggestionDoubleTapped(object sender, TappedEventArgs e) private void OnSearchSuggestionDoubleTapped(object sender, TappedEventArgs e)
{ {
var repo = DataContext as ViewModels.Repository; var repo = DataContext as ViewModels.Repository;
var content = (sender as StackPanel)?.DataContext as string; var content = (sender as StackPanel)?.DataContext as string;