summaryrefslogtreecommitdiff
path: root/lib/blame.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/blame.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/blame.tcl')
-rw-r--r--lib/blame.tcl21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/blame.tcl b/lib/blame.tcl
index 13bfab3..4bdb9a2 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