From a3d744f426e31cbad32c241e3f521d59766e0dd1 Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 8 Jan 2025 21:44:35 +0800 Subject: [PATCH] code_style: run `dotnet format` --- src/App.Commands.cs | 6 +++--- src/App.axaml.cs | 4 ++-- src/Native/MacOS.cs | 5 +++-- src/ViewModels/CreateBranch.cs | 2 +- src/ViewModels/InProgressContexts.cs | 2 +- src/ViewModels/Repository.cs | 2 +- src/ViewModels/SetUpstream.cs | 2 +- src/ViewModels/Welcome.cs | 2 +- src/ViewModels/WorkingCopy.cs | 4 ++-- src/Views/CommitBaseInfo.axaml.cs | 3 ++- src/Views/Launcher.axaml.cs | 2 +- src/Views/SelfUpdate.axaml.cs | 4 +--- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/App.Commands.cs b/src/App.Commands.cs index 18016a1c..41896ee1 100644 --- a/src/App.Commands.cs +++ b/src/App.Commands.cs @@ -29,11 +29,11 @@ namespace SourceGit { get { - #if DISABLE_UPDATE_DETECTION +#if DISABLE_UPDATE_DETECTION return false; - #else +#else return true; - #endif +#endif } } diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 3d1547c9..29a2c81f 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -548,11 +548,11 @@ namespace SourceGit _launcher = new ViewModels.Launcher(startupRepo); desktop.MainWindow = new Views.Launcher() { DataContext = _launcher }; - #if !DISABLE_UPDATE_DETECTION +#if !DISABLE_UPDATE_DETECTION var pref = ViewModels.Preference.Instance; if (pref.ShouldCheck4UpdateOnStartup()) Check4Update(); - #endif +#endif } private ViewModels.Launcher _launcher = null; diff --git a/src/Native/MacOS.cs b/src/Native/MacOS.cs index 5721fe87..c9e6abad 100644 --- a/src/Native/MacOS.cs +++ b/src/Native/MacOS.cs @@ -26,10 +26,11 @@ namespace SourceGit.Native public string FindGitExecutable() { var gitPathVariants = new List() { - "/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) - if (File.Exists(path)) return path; + if (File.Exists(path)) + return path; return string.Empty; } diff --git a/src/ViewModels/CreateBranch.cs b/src/ViewModels/CreateBranch.cs index 7bd8913d..64806a49 100644 --- a/src/ViewModels/CreateBranch.cs +++ b/src/ViewModels/CreateBranch.cs @@ -134,7 +134,7 @@ namespace SourceGit.ViewModels var folderEndIdx = fake.FullName.LastIndexOf('/'); 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) _repo.SetBranchFilterMode(fake, Models.FilterMode.Included, true, false); diff --git a/src/ViewModels/InProgressContexts.cs b/src/ViewModels/InProgressContexts.cs index 78f845f3..6099c2b9 100644 --- a/src/ViewModels/InProgressContexts.cs +++ b/src/ViewModels/InProgressContexts.cs @@ -71,7 +71,7 @@ namespace SourceGit.ViewModels 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(); Head = new Commands.QuerySingleCommit(repo.FullPath, headSHA).Result() ?? new Models.Commit() { SHA = headSHA }; diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 83d23c31..37a7a7ee 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -904,7 +904,7 @@ namespace SourceGit.ViewModels { lock (_lockRemotes) Remotes = remotes; - + Branches = branches; CurrentBranch = branches.Find(x => x.IsCurrent); LocalBranchTrees = builder.Locals; diff --git a/src/ViewModels/SetUpstream.cs b/src/ViewModels/SetUpstream.cs index b4dc24a8..48a03ac0 100644 --- a/src/ViewModels/SetUpstream.cs +++ b/src/ViewModels/SetUpstream.cs @@ -56,7 +56,7 @@ namespace SourceGit.ViewModels public override Task Sure() { SetProgressDescription("Setting upstream..."); - + var upstream = (_unset || SelectedRemoteBranch == null) ? string.Empty : SelectedRemoteBranch.FullName; if (upstream == Local.Upstream) return null; diff --git a/src/ViewModels/Welcome.cs b/src/ViewModels/Welcome.cs index 08d81d44..daedc4c5 100644 --- a/src/ViewModels/Welcome.cs +++ b/src/ViewModels/Welcome.cs @@ -125,7 +125,7 @@ namespace SourceGit.ViewModels App.RaiseException(string.Empty, "The default clone directory hasn't been configured!"); return; } - + if (!Directory.Exists(defaultCloneDir)) { App.RaiseException(string.Empty, $"The default clone directory '{defaultCloneDir}' does not exist!"); diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index bbefd77f..bb809ea5 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -619,7 +619,7 @@ namespace SourceGit.ViewModels useTheirs.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", cherryPick.HeadName); 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); useMine.Header = new Views.NameHighlightedTextBlock("FileCM.ResolveUsing", rebase.BaseName); @@ -971,7 +971,7 @@ namespace SourceGit.ViewModels } 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); } else if (_inProgressContext is MergeInProgress merge) diff --git a/src/Views/CommitBaseInfo.axaml.cs b/src/Views/CommitBaseInfo.axaml.cs index 79f65a4d..ce1a7cfd 100644 --- a/src/Views/CommitBaseInfo.axaml.cs +++ b/src/Views/CommitBaseInfo.axaml.cs @@ -136,7 +136,8 @@ namespace SourceGit.Views Task.Run(() => { var c = detail.GetParent(sha); - if (c == null) return; + if (c == null) + return; Dispatcher.UIThread.Invoke(() => { diff --git a/src/Views/Launcher.axaml.cs b/src/Views/Launcher.axaml.cs index a3a3af8b..2345958c 100644 --- a/src/Views/Launcher.axaml.cs +++ b/src/Views/Launcher.axaml.cs @@ -141,7 +141,7 @@ namespace SourceGit.Views if (vm.ActivePage.Data is not ViewModels.Welcome) vm.AddNewTab(); - ViewModels.Welcome.Instance.Clone(); + ViewModels.Welcome.Instance.Clone(); e.Handled = true; return; } diff --git a/src/Views/SelfUpdate.axaml.cs b/src/Views/SelfUpdate.axaml.cs index cf4d4e55..0c9ccfc7 100644 --- a/src/Views/SelfUpdate.axaml.cs +++ b/src/Views/SelfUpdate.axaml.cs @@ -1,14 +1,12 @@ using System; - using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; - +using AvaloniaEdit; using AvaloniaEdit.Document; using AvaloniaEdit.Editing; using AvaloniaEdit.TextMate; -using AvaloniaEdit; namespace SourceGit.Views {