summaryrefslogtreecommitdiff
path: root/lib/diff.tcl
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-07-09 05:17:09 (GMT)
committerShawn O. Pearce <spearce@spearce.org>2007-07-09 05:17:09 (GMT)
commit0b81261622afad691501ee51d7811048cf4a5fce (patch)
tree0b2862469d7a162e11063bd2fe301c45331c27d2 /lib/diff.tcl
parentb79223064e163aa0ce7f5b63d12158e87f8729e4 (diff)
downloadgit-0b81261622afad691501ee51d7811048cf4a5fce.zip
git-0b81261622afad691501ee51d7811048cf4a5fce.tar.gz
git-0b81261622afad691501ee51d7811048cf4a5fce.tar.bz2
git-gui: Always use absolute path to all git executables
Rather than making the C library search for git every time we want to execute it we now search for the main git wrapper at startup, do symlink resolution, and then always use the absolute path that we found to execute the binary later on. This should save us some cycles, especially on stat challenged systems like Cygwin/Win32. While I was working on this change I also converted all of our existing pipes ([open "| git ..."]) to use two new pipe wrapper functions. These functions take additional options like --nice and --stderr which instructs Tcl to take special action, like running the underlying git program through `nice` (if available) or redirect stderr to stdout for capture in Tcl. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'lib/diff.tcl')
-rw-r--r--lib/diff.tcl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/diff.tcl b/lib/diff.tcl
index 05bf751..9cb9d06 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -131,7 +131,7 @@ proc show_diff {path w {lno {}}} {
return
}
- set cmd [list | git]
+ set cmd [list]
if {$w eq $ui_index} {
lappend cmd diff-index
lappend cmd --cached
@@ -154,7 +154,7 @@ proc show_diff {path w {lno {}}} {
lappend cmd --
lappend cmd $path
- if {[catch {set fd [open $cmd r]} err]} {
+ if {[catch {set fd [eval git_read --nice $cmd]} err]} {
set diff_active 0
unlock_index
ui_status "Unable to display [escape_path $path]"
@@ -271,7 +271,7 @@ proc apply_hunk {x y} {
if {$current_diff_path eq {} || $current_diff_header eq {}} return
if {![lock_index apply_hunk]} return
- set apply_cmd {git apply --cached --whitespace=nowarn}
+ set apply_cmd {apply --cached --whitespace=nowarn}
set mi [lindex $file_states($current_diff_path) 0]
if {$current_diff_side eq $ui_index} {
set mode unstage
@@ -301,7 +301,7 @@ proc apply_hunk {x y} {
}
if {[catch {
- set p [open "| $apply_cmd" w]
+ set p [eval git_write $apply_cmd]
fconfigure $p -translation binary -encoding binary
puts -nonewline $p $current_diff_header
puts -nonewline $p [$ui_diff get $s_lno $e_lno]