summaryrefslogtreecommitdiff
path: root/git-gui/lib/browser.tcl
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-07-12 21:14:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-07-12 21:14:51 (GMT)
commitb9dcf846e20ed5287e239c9a0942c5d150081bab (patch)
treed6a6ae6c6240ac014f47c32e9ecf09b0c50c2dab /git-gui/lib/browser.tcl
parent237ce836e770e8ead12a14ee4a8170009fa4a40b (diff)
parentb215883de9322b8b475a04b4768d6ba5455373d1 (diff)
downloadgit-b9dcf846e20ed5287e239c9a0942c5d150081bab.zip
git-b9dcf846e20ed5287e239c9a0942c5d150081bab.tar.gz
git-b9dcf846e20ed5287e239c9a0942c5d150081bab.tar.bz2
Merge commit 'git-gui/master'
* commit 'git-gui/master': (36 commits) git-gui: Change prior tree SHA-1 verification to use git_read git-gui: Include a space in Cygwin shortcut command lines git-gui: Use sh.exe in Cygwin shortcuts git-gui: Paper bag fix for Cygwin shortcut creation git-gui: Improve the Windows and Mac OS X shortcut creators git-gui: Teach console widget to use git_read git-gui: Perform our own magic shbang detection on Windows git-gui: Treat `git version` as `git --version` git-gui: Assume unfound commands are known by git wrapper git-gui: Correct gitk installation location git-gui: Always use absolute path to all git executables git-gui: Show a progress meter for checking out files git-gui: Change the main window progress bar to use status_bar git-gui: Extract blame viewer status bar into mega-widget git-gui: Allow double-click in checkout dialog to start checkout git-gui: Default selection to first matching ref git-gui: Unabbreviate commit SHA-1s prior to display git-gui: Refactor branch switch to support detached head git-gui: Refactor our ui_status_value update technique git-gui: Better handling of detached HEAD ...
Diffstat (limited to 'git-gui/lib/browser.tcl')
-rw-r--r--git-gui/lib/browser.tcl25
1 files changed, 14 insertions, 11 deletions
diff --git a/git-gui/lib/browser.tcl b/git-gui/lib/browser.tcl
index 3d6341b..911e5af 100644
--- a/git-gui/lib/browser.tcl
+++ b/git-gui/lib/browser.tcl
@@ -11,6 +11,8 @@ field browser_status {Starting...}
field browser_stack {}
field browser_busy 1
+field ls_buf {}; # Buffered record output from ls-tree
+
constructor new {commit} {
global cursor_ptr M1B
make_toplevel top w
@@ -160,7 +162,7 @@ method _click {was_double_click pos} {
}
method _ls {tree_id {name {}}} {
- set browser_buffer {}
+ set ls_buf {}
set browser_files {}
set browser_busy 1
@@ -178,24 +180,25 @@ method _ls {tree_id {name {}}} {
lappend browser_stack [list $tree_id $name]
$w conf -state disabled
- set cmd [list git ls-tree -z $tree_id]
- set fd [open "| $cmd" r]
+ set fd [git_read ls-tree -z $tree_id]
fconfigure $fd -blocking 0 -translation binary -encoding binary
fileevent $fd readable [cb _read $fd]
}
method _read {fd} {
- append browser_buffer [read $fd]
- set pck [split $browser_buffer "\0"]
- set browser_buffer [lindex $pck end]
+ append ls_buf [read $fd]
+ set pck [split $ls_buf "\0"]
+ set ls_buf [lindex $pck end]
set n [llength $browser_files]
$w conf -state normal
foreach p [lrange $pck 0 end-1] {
- set info [split $p "\t"]
- set path [lindex $info 1]
- set info [split [lindex $info 0] { }]
- set type [lindex $info 1]
+ set tab [string first "\t" $p]
+ if {$tab == -1} continue
+
+ set info [split [string range $p 0 [expr {$tab - 1}]] { }]
+ set path [string range $p [expr {$tab + 1}] end]
+ set type [lindex $info 1]
set object [lindex $info 2]
switch -- $type {
@@ -225,7 +228,7 @@ method _read {fd} {
close $fd
set browser_status Ready.
set browser_busy 0
- unset browser_buffer
+ set ls_buf {}
if {$n > 0} {
$w tag add in_sel 1.0 2.0
focus -force $w