diff --git a/src/Commands/Command.cs b/src/Commands/Command.cs index 83a29ddf..4d5efaa4 100644 --- a/src/Commands/Command.cs +++ b/src/Commands/Command.cs @@ -126,10 +126,8 @@ namespace SourceGit.Commands } return false; } - else - { - return true; - } + + return true; } public ReadToEndResult ReadToEnd() diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 1d6563b9..275ddf5a 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -327,6 +327,7 @@ REPOSITORY Commit staged changes Commit and push staged changes + Stage all changes and commit Discard selected changes Dashboard mode (Default) Force to reload this repository @@ -622,6 +623,8 @@ COMMIT & PUSH Template/Histories CTRL + Enter + Use 'Alt+Enter' to stage all changes and commit + Use '⌥+Enter' to stage all changes and commit CONFLICTS DETECTED FILE CONFLICTS ARE RESOLVED INCLUDE UNTRACKED FILES diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 7915cc53..2d5cc4b8 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -330,6 +330,7 @@ 仓库页面快捷键 提交暂存区更改 提交暂存区更改并推送 + 自动暂存全部变更并提交 丢弃选中的更改 切换左边栏为分支/标签等显示模式(默认) 重新加载仓库状态 @@ -620,6 +621,8 @@ 提交并推送 历史输入/模板 CTRL + Enter + 使用 Alt+Enter 自动暂存所有变更并提交 + 使用 ⌥+Enter 自动暂存所有变更并提交 检测到冲突 文件冲突已解决 显示未跟踪文件 diff --git a/src/Resources/Locales/zh_TW.axaml b/src/Resources/Locales/zh_TW.axaml index cb8fc19d..1c07df18 100644 --- a/src/Resources/Locales/zh_TW.axaml +++ b/src/Resources/Locales/zh_TW.axaml @@ -330,6 +330,7 @@ 存放庫頁面快速鍵 提交暫存區變更 提交暫存區變更並推送 + 自動暫存全部變更並提交 捨棄選取的變更 切換左邊欄為分支/標籤等顯示模式 (預設) 強制重新載入存放庫 @@ -625,6 +626,8 @@ 提交並推送 歷史輸入/範本 CTRL + Enter + 使用 Alt+Enter 自動暫存全部變更並提交 + 使用 ⌥+Enter 自動暫存全部變更並提交 檢測到衝突 檔案衝突已解決 顯示未追蹤檔案 diff --git a/src/ViewModels/WorkingCopy.cs b/src/ViewModels/WorkingCopy.cs index 2dad3fc2..74ff3e0e 100644 --- a/src/ViewModels/WorkingCopy.cs +++ b/src/ViewModels/WorkingCopy.cs @@ -240,11 +240,6 @@ namespace SourceGit.ViewModels _cached = changes; _count = _cached.Count; - var unstaged = new List(); - var staged = new List(); - var selectedUnstaged = new List(); - var selectedStaged = new List(); - var lastSelectedUnstaged = new HashSet(); var lastSelectedStaged = new HashSet(); if (_selectedUnstaged != null && _selectedUnstaged.Count > 0) @@ -258,6 +253,8 @@ namespace SourceGit.ViewModels lastSelectedStaged.Add(c.Path); } + var unstaged = new List(); + var selectedUnstaged = new List(); var hasConflict = false; foreach (var c in changes) { @@ -271,7 +268,8 @@ namespace SourceGit.ViewModels } } - staged = GetStagedChanges(); + var staged = GetStagedChanges(); + var selectedStaged = new List(); foreach (var c in staged) { if (lastSelectedStaged.Contains(c.Path)) @@ -418,12 +416,17 @@ namespace SourceGit.ViewModels public void Commit() { - DoCommit(false); + DoCommit(AutoStageBeforeCommit, false); + } + + public void CommitWithAutoStage() + { + DoCommit(true, false); } public void CommitWithPush() { - DoCommit(true); + DoCommit(AutoStageBeforeCommit, true); } public ContextMenu CreateContextMenuForUnstagedChanges() @@ -1276,7 +1279,7 @@ namespace SourceGit.ViewModels _repo.SetWatcherEnabled(true); } - private void DoCommit(bool autoPush) + private void DoCommit(bool autoStage, bool autoPush) { if (!PopupHost.CanCreatePopup()) { @@ -1290,7 +1293,6 @@ namespace SourceGit.ViewModels return; } - var autoStage = AutoStageBeforeCommit; if (!_useAmend) { if (autoStage) diff --git a/src/Views/Hotkeys.axaml b/src/Views/Hotkeys.axaml index cd7f9c4a..45fc1c08 100644 --- a/src/Views/Hotkeys.axaml +++ b/src/Views/Hotkeys.axaml @@ -78,7 +78,7 @@ FontSize="{Binding Source={x:Static vm:Preference.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Increase}}" Margin="0,8"/> - + @@ -102,12 +102,15 @@ + + + - - + + - - + + - + + + +