зеркало из https://github.com/microsoft/git.git
git-gui: Add menu option to include only selected files.
When the user selects a number of files they would typically expect to be able to act on that selection, such as by including those files into the next commit. So we now have a menu option under the Commit menu that lets the user include only the selection, rather than everything. If there is no selection but there is a file in the diff viewer than we consider that to be the selection (a selection of 1). Unfortunately we don't disable this option yet when there's nothing selected to include, but this is probably not a big deal as there are very few situations where there are no selected files. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Родитель
b676511298
Коммит
c4ed879fc2
32
git-gui
32
git-gui
|
@ -1853,14 +1853,14 @@ proc do_rescan {} {
|
|||
rescan {set ui_status_value {Ready.}}
|
||||
}
|
||||
|
||||
proc do_include_all {} {
|
||||
proc include_helper {txt paths} {
|
||||
global file_states current_diff
|
||||
|
||||
if {![lock_index begin-update]} return
|
||||
|
||||
set pathList [list]
|
||||
set after {}
|
||||
foreach path [array names file_states] {
|
||||
foreach path $paths {
|
||||
switch -- [lindex $file_states($path) 0] {
|
||||
AM -
|
||||
MM -
|
||||
|
@ -1877,12 +1877,33 @@ proc do_include_all {} {
|
|||
unlock_index
|
||||
} else {
|
||||
update_index \
|
||||
"Including all modified files" \
|
||||
$txt \
|
||||
$pathList \
|
||||
[concat $after {set ui_status_value {Ready to commit.}}]
|
||||
}
|
||||
}
|
||||
|
||||
proc do_include_selection {} {
|
||||
global current_diff selected_paths
|
||||
|
||||
if {[array size selected_paths] > 0} {
|
||||
include_helper \
|
||||
{Including selected files} \
|
||||
[array names selected_paths]
|
||||
} elseif {$current_diff ne {}} {
|
||||
include_helper \
|
||||
"Including [short_path $current_diff]" \
|
||||
[list $current_diff]
|
||||
}
|
||||
}
|
||||
|
||||
proc do_include_all {} {
|
||||
global file_states
|
||||
include_helper \
|
||||
{Including all modified files} \
|
||||
[array names file_states]
|
||||
}
|
||||
|
||||
set GIT_COMMITTER_IDENT {}
|
||||
|
||||
proc do_signoff {} {
|
||||
|
@ -2442,6 +2463,11 @@ lappend disable_on_lock \
|
|||
-font font_ui
|
||||
lappend disable_on_lock \
|
||||
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
||||
.mbar.commit add command -label {Include Selected Files} \
|
||||
-command do_include_selection \
|
||||
-font font_ui
|
||||
lappend disable_on_lock \
|
||||
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
||||
.mbar.commit add command -label {Include All Files} \
|
||||
-command do_include_all \
|
||||
-accelerator $M1T-I \
|
||||
|
|
Загрузка…
Ссылка в новой задаче