code_style: run dotnet format

This commit is contained in:
leo 2025-01-08 21:44:35 +08:00
parent f06b1d5d51
commit a3d744f426
No known key found for this signature in database
12 changed files with 19 additions and 19 deletions

View file

@ -29,11 +29,11 @@ namespace SourceGit
{ {
get get
{ {
#if DISABLE_UPDATE_DETECTION #if DISABLE_UPDATE_DETECTION
return false; return false;
#else #else
return true; return true;
#endif #endif
} }
} }

View file

@ -548,11 +548,11 @@ namespace SourceGit
_launcher = new ViewModels.Launcher(startupRepo); _launcher = new ViewModels.Launcher(startupRepo);
desktop.MainWindow = new Views.Launcher() { DataContext = _launcher }; desktop.MainWindow = new Views.Launcher() { DataContext = _launcher };
#if !DISABLE_UPDATE_DETECTION #if !DISABLE_UPDATE_DETECTION
var pref = ViewModels.Preference.Instance; var pref = ViewModels.Preference.Instance;
if (pref.ShouldCheck4UpdateOnStartup()) if (pref.ShouldCheck4UpdateOnStartup())
Check4Update(); Check4Update();
#endif #endif
} }
private ViewModels.Launcher _launcher = null; private ViewModels.Launcher _launcher = null;

View file

@ -26,10 +26,11 @@ namespace SourceGit.Native
public string FindGitExecutable() public string FindGitExecutable()
{ {
var gitPathVariants = new List<string>() { var gitPathVariants = new List<string>() {
"/usr/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git", "/opt/homebrew/opt/git/bin/git" "/usr/bin/git", "/usr/local/bin/git", "/opt/homebrew/bin/git", "/opt/homebrew/opt/git/bin/git"
}; };
foreach (var path in gitPathVariants) foreach (var path in gitPathVariants)
if (File.Exists(path)) return path; if (File.Exists(path))
return path;
return string.Empty; return string.Empty;
} }

View file

@ -134,7 +134,7 @@ namespace SourceGit.ViewModels
var folderEndIdx = fake.FullName.LastIndexOf('/'); var folderEndIdx = fake.FullName.LastIndexOf('/');
if (folderEndIdx > 10) if (folderEndIdx > 10)
_repo.Settings.ExpandedBranchNodesInSideBar.Add(fake.FullName.Substring(0, folderEndIdx)); _repo.Settings.ExpandedBranchNodesInSideBar.Add(fake.FullName.Substring(0, folderEndIdx));
if (_repo.HistoriesFilterMode == Models.FilterMode.Included) if (_repo.HistoriesFilterMode == Models.FilterMode.Included)
_repo.SetBranchFilterMode(fake, Models.FilterMode.Included, true, false); _repo.SetBranchFilterMode(fake, Models.FilterMode.Included, true, false);

View file

@ -71,7 +71,7 @@ namespace SourceGit.ViewModels
get => GetFriendlyNameOfCommit(Head); get => GetFriendlyNameOfCommit(Head);
} }
public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick") public CherryPickInProgress(Repository repo) : base(repo.FullPath, "cherry-pick")
{ {
var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD")).Trim(); var headSHA = File.ReadAllText(Path.Combine(repo.GitDir, "CHERRY_PICK_HEAD")).Trim();
Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result() ?? new Models.Commit() { SHA = headSHA }; Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result() ?? new Models.Commit() { SHA = headSHA };

View file

@ -904,7 +904,7 @@ namespace SourceGit.ViewModels
{ {
lock (_lockRemotes) lock (_lockRemotes)
Remotes = remotes; Remotes = remotes;
Branches = branches; Branches = branches;
CurrentBranch = branches.Find(x => x.IsCurrent); CurrentBranch = branches.Find(x => x.IsCurrent);
LocalBranchTrees = builder.Locals; LocalBranchTrees = builder.Locals;

View file

@ -56,7 +56,7 @@ namespace SourceGit.ViewModels
public override Task<bool> Sure() public override Task<bool> Sure()
{ {
SetProgressDescription("Setting upstream..."); SetProgressDescription("Setting upstream...");
var upstream = (_unset || SelectedRemoteBranch == null) ? string.Empty : SelectedRemoteBranch.FullName; var upstream = (_unset || SelectedRemoteBranch == null) ? string.Empty : SelectedRemoteBranch.FullName;
if (upstream == Local.Upstream) if (upstream == Local.Upstream)
return null; return null;

View file

@ -125,7 +125,7 @@ namespace SourceGit.ViewModels
App.RaiseException(string.Empty, "The default clone directory hasn't been configured!"); App.RaiseException(string.Empty, "The default clone directory hasn't been configured!");
return; return;
} }
if (!Directory.Exists(defaultCloneDir)) if (!Directory.Exists(defaultCloneDir))
{ {
App.RaiseException(string.Empty, $"The default clone directory '{defaultCloneDir}' does not exist!"); App.RaiseException(string.Empty, $"The default clone directory '{defaultCloneDir}' does not exist!");

View file

@ -619,7 +619,7 @@ namespace SourceGit.ViewModels
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName); useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName);
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name); useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
} }
else if(_inProgressContext is RebaseInProgress rebase) else if (_inProgressContext is RebaseInProgress rebase)
{ {
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.HeadName); useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.HeadName);
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName); useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName);
@ -971,7 +971,7 @@ namespace SourceGit.ViewModels
} }
else if (_inProgressContext is RevertInProgress revert) else if (_inProgressContext is RevertInProgress revert)
{ {
useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", revert.Head.SHA.Substring(0,10) + " (revert)"); useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", revert.Head.SHA.Substring(0, 10) + " (revert)");
useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name); useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", _repo.CurrentBranch.Name);
} }
else if (_inProgressContext is MergeInProgress merge) else if (_inProgressContext is MergeInProgress merge)

View file

@ -136,7 +136,8 @@ namespace SourceGit.Views
Task.Run(() => Task.Run(() =>
{ {
var c = detail.GetParent(sha); var c = detail.GetParent(sha);
if (c == null) return; if (c == null)
return;
Dispatcher.UIThread.Invoke(() => Dispatcher.UIThread.Invoke(() =>
{ {

View file

@ -141,7 +141,7 @@ namespace SourceGit.Views
if (vm.ActivePage.Data is not ViewModels.Welcome) if (vm.ActivePage.Data is not ViewModels.Welcome)
vm.AddNewTab(); vm.AddNewTab();
ViewModels.Welcome.Instance.Clone(); ViewModels.Welcome.Instance.Clone();
e.Handled = true; e.Handled = true;
return; return;
} }

View file

@ -1,14 +1,12 @@
using System; using System;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using AvaloniaEdit;
using AvaloniaEdit.Document; using AvaloniaEdit.Document;
using AvaloniaEdit.Editing; using AvaloniaEdit.Editing;
using AvaloniaEdit.TextMate; using AvaloniaEdit.TextMate;
using AvaloniaEdit;
namespace SourceGit.Views namespace SourceGit.Views
{ {