@matheusbsbs / matheus-bagliano / commits / 6eb420ef61
Fork 0

git-gui: Always disable the Tcl EOF character when reading

On Windows (which includes Cygwin) Tcl defaults to leaving the EOF character of input file streams set to the ASCII EOF character, but if that character were to appear in the data stream then Tcl will close the channel early. So we have to disable eofchar on Windows. Since the default is disabled on all platforms except Windows, we can just disable it everywhere to prevent any sort of read problem. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 17, 2007 at 01:50 UTC 6eb420ef61317b2efa2993868a6302afed6ae60a
4 files changed +5 -1
git-gui.sh
+2
@@ -414,6 +414,7 @@ proc _open_stdout_stderr {cmd} {
414 error $err
415 }
416 }
417 + fconfigure $fd -eofchar {}
418 return $fd
419 }
420
@@ -828,6 +829,7 @@ proc load_message {file} {
829 if {[catch {set fd [open $f r]}]} {
830 return 0
831 }
832 + fconfigure $fd -eofchar {}
833 set content [string trim [read $fd]]
834 close $fd
835 regsub -all -line {[ \r\t]+$} $content {} content
lib/blame.tcl
+1
@@ -370,6 +370,7 @@ method _load {jump} {
370 $w_path conf -text [escape_path $path]
371 if {$commit eq {}} {
372 set fd [open $path r]
373 + fconfigure $fd -eofchar {}
374 } else {
375 set fd [git_read cat-file blob "$commit:$path"]
376 }
lib/commit.tcl
+1 -1
@@ -209,7 +209,7 @@ A good commit message has the following format:
209 ui_status {Calling pre-commit hook...}
210 set pch_error {}
211 set fd_ph [open "| $pchook" r]
212 - fconfigure $fd_ph -blocking 0 -translation binary
212 + fconfigure $fd_ph -blocking 0 -translation binary -eofchar {}
213 fileevent $fd_ph readable \
214 [list commit_prehook_wait $fd_ph $curHEAD $msg]
215 }
lib/diff.tcl
+1
@@ -86,6 +86,7 @@ proc show_diff {path w {lno {}}} {
86 set max_sz [expr {128 * 1024}]
87 if {[catch {
88 set fd [open $path r]
89 + fconfigure $fd -eofchar {}
90 set content [read $fd $max_sz]
91 close $fd
92 set sz [file size $path]