git-gui: Allow adding untracked files in selection.
The previous implementation of do_include_selection did not actually add files in state _O (untracked, not added) into the repository when they were in the selection and Commit->Include Selected Files was used. This was due to the file state filtering logic being the same as that of Commit->Include All Files, which only considers existing files. Also fixed a minor issue with rejected attempts to amend an initial commit. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Nov 18, 2006 at 21:33 UTC
54896cf7c150038bd286b909897673f85c691abc
1 file changed
+18
-3
git-gui
+18
-3
@@ -1891,9 +1891,13 @@ proc include_helper {txt paths} {
1891
foreach path $paths {
1892
switch -- [lindex $file_states($path) 0] {
1893
AM -
1894
+ AD -
1895
MM -
1896
+ UM -
1897
+ U_ -
1898
_M -
1896
- _D {
1899
+ _D -
1900
+ _O {
1901
lappend pathList $path
1902
if {$path eq $current_diff} {
1903
set after {reshow_diff;}
@@ -1927,9 +1931,20 @@ proc do_include_selection {} {
1931
1932
proc do_include_all {} {
1933
global file_states
1934
+
1935
+ set paths [list]
1936
+ foreach path [array names file_states] {
1937
+ switch -- [lindex $file_states($path) 0] {
1938
+ AM -
1939
+ AD -
1940
+ MM -
1941
+ _M -
1942
+ _D {lappend paths $path}
1943
+ }
1944
+ }
1945
include_helper \
1946
{Including all modified files} \
1932
- [array names file_states]
1947
+ $paths
1948
}
1949
1950
proc do_signoff {} {
@@ -1965,7 +1980,7 @@ proc do_select_commit_type {} {
1980
# The amend request was rejected...
1981
#
1982
if {![string match amend* $commit_type]} {
1968
- set commit_type new
1983
+ set selected_commit_type new
1984
}
1985
}
1986
}