From a75d50bf97f972c1a025295ff9fe19cfc3f5a3d1 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 9 Aug 2024 11:33:37 +0800 Subject: [PATCH] refactor: rename `Models.Watcher.UpdateSubmodules` to `Models.Watcher.SetSubmodules` * run `dotnet format` --- src/Models/Submodule.cs | 2 +- src/Models/Watcher.cs | 4 ++-- src/ViewModels/Repository.cs | 4 ++-- src/ViewModels/WorkingCopy.cs | 4 ++-- src/Views/Histories.axaml.cs | 6 +++--- src/Views/InteractiveRebase.axaml.cs | 6 +++--- src/Views/RevisionFiles.axaml.cs | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Models/Submodule.cs b/src/Models/Submodule.cs index a038afef..ce00ac02 100644 --- a/src/Models/Submodule.cs +++ b/src/Models/Submodule.cs @@ -3,6 +3,6 @@ public class Submodule { public string Path { get; set; } = ""; - public bool IsDirty { get; set; } = false; + public bool IsDirty { get; set; } = false; } } diff --git a/src/Models/Watcher.cs b/src/Models/Watcher.cs index 971c44f6..3295ff93 100644 --- a/src/Models/Watcher.cs +++ b/src/Models/Watcher.cs @@ -71,7 +71,7 @@ namespace SourceGit.Models } } - public void UpdateSubmodules(List submodules) + public void SetSubmodules(List submodules) { lock (_lockSubmodule) { @@ -223,7 +223,7 @@ namespace SourceGit.Models return; } } - } + } _updateWC = DateTime.Now.AddSeconds(1).ToFileTime(); } diff --git a/src/ViewModels/Repository.cs b/src/ViewModels/Repository.cs index 17e395ca..d1d7606b 100644 --- a/src/ViewModels/Repository.cs +++ b/src/ViewModels/Repository.cs @@ -778,8 +778,8 @@ namespace SourceGit.ViewModels public void RefreshSubmodules() { var submodules = new Commands.QuerySubmodules(_fullpath).Result(); - if (_watcher != null) - _watcher.UpdateSubmodules(submodules); + if (_watcher != null) + _watcher.SetSubmodules(submodules); Dispatcher.UIThread.Invoke(() => Submodules = submodules); } diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index b4a08fdb..3e93d82b 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -1238,7 +1238,7 @@ namespace SourceGit.ViewModels App.RaiseException(_repo.FullPath, "Repository has unfinished job! Please wait!"); return; } - + if (string.IsNullOrWhiteSpace(_commitMessage)) { App.RaiseException(_repo.FullPath, "Commit without message is NOT allowed!"); @@ -1264,7 +1264,7 @@ namespace SourceGit.ViewModels } } } - + IsCommitting = true; _repo.Settings.PushCommitMessage(_commitMessage); _repo.SetWatcherEnabled(false); diff --git a/src/Views/Histories.axaml.cs b/src/Views/Histories.axaml.cs index 7e2feaa6..5ec11eea 100644 --- a/src/Views/Histories.axaml.cs +++ b/src/Views/Histories.axaml.cs @@ -523,9 +523,9 @@ namespace SourceGit.Views private void OnCommitDataGridKeyDown(object sender, KeyEventArgs e) { - if (sender is DataGrid grid && - grid.SelectedItems is { Count: > 0 } selected && - e.Key == Key.C && + if (sender is DataGrid grid && + grid.SelectedItems is { Count: > 0 } selected && + e.Key == Key.C && e.KeyModifiers.HasFlag(KeyModifiers.Control)) { var builder = new StringBuilder(); diff --git a/src/Views/InteractiveRebase.axaml.cs b/src/Views/InteractiveRebase.axaml.cs index 453f1a6c..0660f7c9 100644 --- a/src/Views/InteractiveRebase.axaml.cs +++ b/src/Views/InteractiveRebase.axaml.cs @@ -43,7 +43,7 @@ namespace SourceGit.Views private void OnRowHeaderDragOver(object sender, DragEventArgs e) { if (DataContext is ViewModels.InteractiveRebase vm && - e.Data.Get("InteractiveRebaseItem") is ViewModels.InteractiveRebaseItem src && + e.Data.Get("InteractiveRebaseItem") is ViewModels.InteractiveRebaseItem src && sender is Border { DataContext: ViewModels.InteractiveRebaseItem dst } border && src != dst) { @@ -64,8 +64,8 @@ namespace SourceGit.Views for (var i = srcIdx; i > dstIdx; i--) vm.MoveItemUp(src); } - } - + } + e.Handled = true; } } diff --git a/src/Views/RevisionFiles.axaml.cs b/src/Views/RevisionFiles.axaml.cs index 3ef430ad..b76e1360 100644 --- a/src/Views/RevisionFiles.axaml.cs +++ b/src/Views/RevisionFiles.axaml.cs @@ -66,7 +66,7 @@ namespace SourceGit.Views else { Text = string.Empty; - } + } } private void OnTextViewContextRequested(object sender, ContextRequestedEventArgs e)