Revert "git-gui: remove lines starting with the comment character"

This reverts commit b9a43869c9f96d3577d6f568c1bda1940c8f0e31. This commit causes breakage on macOS (10.13). It causes errors on startup and completely breaks the commit functionality. There are two main problems. First, it uses `string cat` which is not supported on older Tcl versions. Second, it does a half close of the bidirectional pipe to git-stripspace which is also not supported on older Tcl versions. Reported-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Pratyush Yadav committed Mar 4, 2021 at 13:53 UTC c0698df0579a14270e491b2f1ffdfc39d3b86310
2 files changed +2 -21
git-gui.sh
-5
@@ -875,7 +875,6 @@ set default_config(merge.summary) false
875 set default_config(merge.verbosity) 2
876 set default_config(user.name) {}
877 set default_config(user.email) {}
878 -set default_config(core.commentchar) "#"
878
879 set default_config(gui.encoding) [encoding system]
880 set default_config(gui.matchtrackingbranch) false
@@ -3437,10 +3436,6 @@ proc trace_commit_type {varname args} {
3436 merge {set txt [mc "Merge Commit Message:"]}
3437 * {set txt [mc "Commit Message:"]}
3438 }
3440 -
3441 - set comment_char [get_config core.commentchar]
3442 - set txt [string cat $txt \
3443 - [mc " (Lines starting with '$comment_char' will be ignored)"]]
3439 $ui_coml conf -text $txt
3440 }
3441 trace add variable commit_type write trace_commit_type
lib/commit.tcl
+2 -16
@@ -141,20 +141,6 @@ proc setup_commit_encoding {msg_wt {quiet 0}} {
141 }
142 }
143
144 -proc strip_msg {msg} {
145 - set cmd [concat [list | ] [_git_cmd stripspace] --strip-comments]
146 - _trace_exec $cmd
147 - set fd [open $cmd r+]
148 - fconfigure $fd -translation binary -encoding utf-8
149 -
150 - puts -nonewline $fd $msg
151 - close $fd w
152 - set result [read $fd]
153 - close $fd
154 -
155 - return $result
156 -}
157 -
144 proc commit_tree {} {
145 global HEAD commit_type file_states ui_comm repo_config
146 global pch_error
@@ -221,8 +207,8 @@ You must stage at least 1 file before you can commit.
207
208 # -- A message is required.
209 #
224 - set msg [strip_msg [$ui_comm get 1.0 end]]
225 -
210 + set msg [string trim [$ui_comm get 1.0 end]]
211 + regsub -all -line {[ \t\r]+$} $msg {} msg
212 if {$msg eq {}} {
213 error_popup [mc "Please supply a commit message.
214