git-gui: Allow adding untracked files in selection.
[gitweb.git] / git-gui
diff --git a/git-gui b/git-gui
index 5c6af8940ee15e0e68b89c0fadb131585d6ab3b1..d1054f6632794dc35e80c993033062aa0da45f95 100755 (executable)
--- a/git-gui
+++ b/git-gui
@@ -732,10 +732,31 @@ proc create_new_commit {} {
        rescan {set ui_status_value {Ready.}}
 }
 
+set GIT_COMMITTER_IDENT {}
+
+proc committer_ident {} {
+       global GIT_COMMITTER_IDENT
+
+       if {$GIT_COMMITTER_IDENT eq {}} {
+               if {[catch {set me [exec git var GIT_COMMITTER_IDENT]} err]} {
+                       error_popup "Unable to obtain your identity:\n\n$err"
+                       return {}
+               }
+               if {![regexp {^(.*) [0-9]+ [-+0-9]+$} \
+                       $me me GIT_COMMITTER_IDENT]} {
+                       error_popup "Invalid GIT_COMMITTER_IDENT:\n\n$me"
+                       return {}
+               }
+       }
+
+       return $GIT_COMMITTER_IDENT
+}
+
 proc commit_tree {} {
        global HEAD commit_type file_states ui_comm repo_config
 
        if {![lock_index update]} return
+       if {[committer_ident] eq {}} return
 
        # -- Our in memory state should match the repository.
        #
@@ -744,13 +765,13 @@ proc commit_tree {} {
                && $cur_type eq {normal}
                && $curHEAD eq $HEAD} {
        } elseif {$commit_type ne $cur_type || $HEAD ne $curHEAD} {
-               error_popup {Last scanned state does not match repository state.
+               info_popup {Last scanned state does not match repository state.
 
-Its highly likely that another Git program modified the
-repository since the last scan.  A rescan is required
-before committing.
+Another Git program has modified this repository
+since the last scan.  A rescan must be performed
+before another commit can be created.
 
-A rescan will be automatically started now.
+The rescan will be automatically started now.
 }
                unlock_index
                rescan {set ui_status_value {Ready.}}
@@ -1870,9 +1891,13 @@ proc include_helper {txt paths} {
        foreach path $paths {
                switch -- [lindex $file_states($path) 0] {
                AM -
+               AD -
                MM -
+               UM -
+               U_ -
                _M -
-               _D {
+               _D -
+               _O {
                        lappend pathList $path
                        if {$path eq $current_diff} {
                                set after {reshow_diff;}
@@ -1906,29 +1931,29 @@ proc do_include_selection {} {
 
 proc do_include_all {} {
        global file_states
+
+       set paths [list]
+       foreach path [array names file_states] {
+               switch -- [lindex $file_states($path) 0] {
+               AM -
+               AD -
+               MM -
+               _M -
+               _D {lappend paths $path}
+               }
+       }
        include_helper \
                {Including all modified files} \
-               [array names file_states]
+               $paths
 }
 
-set GIT_COMMITTER_IDENT {}
-
 proc do_signoff {} {
-       global ui_comm GIT_COMMITTER_IDENT
+       global ui_comm
 
-       if {$GIT_COMMITTER_IDENT eq {}} {
-               if {[catch {set me [exec git var GIT_COMMITTER_IDENT]} err]} {
-                       error_popup "Unable to obtain your identity:\n\n$err"
-                       return
-               }
-               if {![regexp {^(.*) [0-9]+ [-+0-9]+$} \
-                       $me me GIT_COMMITTER_IDENT]} {
-                       error_popup "Invalid GIT_COMMITTER_IDENT:\n\n$me"
-                       return
-               }
-       }
+       set me [committer_ident]
+       if {$me eq {}} return
 
-       set sob "Signed-off-by: $GIT_COMMITTER_IDENT"
+       set sob "Signed-off-by: $me"
        set last [$ui_comm get {end -1c linestart} {end -1c}]
        if {$last ne $sob} {
                $ui_comm edit separator
@@ -1955,7 +1980,7 @@ proc do_select_commit_type {} {
                # The amend request was rejected...
                #
                if {![string match amend* $commit_type]} {
-                       set commit_type new
+                       set selected_commit_type new
                }
        }
 }