diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-07-17 05:50:10 (GMT) |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-07-17 05:50:10 (GMT) |
commit | 6eb420ef61317b2efa2993868a6302afed6ae60a (patch) | |
tree | 541e028be7e8c85d4236f9fff05d8c4b73a17533 | |
parent | ec4fceece4a9f155afcadec254caff5cef781c67 (diff) | |
download | git-6eb420ef61317b2efa2993868a6302afed6ae60a.zip git-6eb420ef61317b2efa2993868a6302afed6ae60a.tar.gz git-6eb420ef61317b2efa2993868a6302afed6ae60a.tar.bz2 |
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>
-rwxr-xr-x | git-gui.sh | 2 | ||||
-rw-r--r-- | lib/blame.tcl | 1 | ||||
-rw-r--r-- | lib/commit.tcl | 2 | ||||
-rw-r--r-- | lib/diff.tcl | 1 |
4 files changed, 5 insertions, 1 deletions
@@ -414,6 +414,7 @@ proc _open_stdout_stderr {cmd} { error $err } } + fconfigure $fd -eofchar {} return $fd } @@ -828,6 +829,7 @@ proc load_message {file} { if {[catch {set fd [open $f r]}]} { return 0 } + fconfigure $fd -eofchar {} set content [string trim [read $fd]] close $fd regsub -all -line {[ \r\t]+$} $content {} content diff --git a/lib/blame.tcl b/lib/blame.tcl index 4bdb9a2..1bcb4b4 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -370,6 +370,7 @@ method _load {jump} { $w_path conf -text [escape_path $path] if {$commit eq {}} { set fd [open $path r] + fconfigure $fd -eofchar {} } else { set fd [git_read cat-file blob "$commit:$path"] } diff --git a/lib/commit.tcl b/lib/commit.tcl index 46a78c1..0f3b16d 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -209,7 +209,7 @@ A good commit message has the following format: ui_status {Calling pre-commit hook...} set pch_error {} set fd_ph [open "| $pchook" r] - fconfigure $fd_ph -blocking 0 -translation binary + fconfigure $fd_ph -blocking 0 -translation binary -eofchar {} fileevent $fd_ph readable \ [list commit_prehook_wait $fd_ph $curHEAD $msg] } diff --git a/lib/diff.tcl b/lib/diff.tcl index 9cb9d06..e09e125 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -86,6 +86,7 @@ proc show_diff {path w {lno {}}} { set max_sz [expr {128 * 1024}] if {[catch { set fd [open $path r] + fconfigure $fd -eofchar {} set content [read $fd $max_sz] close $fd set sz [file size $path] |