diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-07-09 01:17:09 -0400 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-07-09 01:17:09 -0400 |
commit | 0b81261622afad691501ee51d7811048cf4a5fce (patch) | |
tree | 0b2862469d7a162e11063bd2fe301c45331c27d2 /lib/blame.tcl | |
parent | git-gui: Show a progress meter for checking out files (diff) | |
download | tgif-0b81261622afad691501ee51d7811048cf4a5fce.tar.xz |
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/blame.tcl')
-rw-r--r-- | lib/blame.tcl | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/blame.tcl b/lib/blame.tcl index 13bfab3352..4bdb9a27a3 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -371,8 +371,7 @@ method _load {jump} { if {$commit eq {}} { set fd [open $path r] } else { - set cmd [list git cat-file blob "$commit:$path"] - set fd [open "| $cmd" r] + set fd [git_read cat-file blob "$commit:$path"] } fconfigure $fd -blocking 0 -translation lf -encoding binary fileevent $fd readable [cb _read_file $fd $jump] @@ -475,20 +474,14 @@ method _read_file {fd jump} { } ifdeleted { catch {close $fd} } method _exec_blame {cur_w cur_d options cur_s} { - set cmd [list] - if {![is_Windows] || [is_Cygwin]} { - lappend cmd nice - } - lappend cmd git blame - set cmd [concat $cmd $options] - lappend cmd --incremental + lappend options --incremental if {$commit eq {}} { - lappend cmd --contents $path + lappend options --contents $path } else { - lappend cmd $commit + lappend options $commit } - lappend cmd -- $path - set fd [open "| $cmd" r] + lappend options -- $path + set fd [eval git_read --nice blame $options] fconfigure $fd -blocking 0 -translation lf -encoding binary fileevent $fd readable [cb _read_blame $fd $cur_w $cur_d] set current_fd $fd @@ -767,7 +760,7 @@ method _showcommit {cur_w lno} { if {[catch {set msg $header($cmit,message)}]} { set msg {} catch { - set fd [open "| git cat-file commit $cmit" r] + set fd [git_read cat-file commit $cmit] fconfigure $fd -encoding binary -translation lf if {[catch {set enc $repo_config(i18n.commitencoding)}]} { set enc utf-8 |