summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 88dce86)
raw | patch | inline | side by side (parent: 88dce86)
author | Shawn O. Pearce <spearce@spearce.org> | |
Mon, 9 Jul 2007 15:55:45 +0000 (11:55 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Tue, 10 Jul 2007 01:12:35 +0000 (21:12 -0400) |
Our file browser was showing bad output as it did not properly buffer
a partial record when read from `ls-tree -z`. This did not show up on
my Mac OS X system as most trees are small, the pipe buffers generally
big and `ls-tree -z` was generally fast enough that all data was ready
before Tcl started to read. However on my Cygwin system one of my
production repositories had a large enough tree and packfile that it
took a couple of pipe buffers for `ls-tree -z` to complete its dump.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
a partial record when read from `ls-tree -z`. This did not show up on
my Mac OS X system as most trees are small, the pipe buffers generally
big and `ls-tree -z` was generally fast enough that all data was ready
before Tcl started to read. However on my Cygwin system one of my
production repositories had a large enough tree and packfile that it
took a couple of pipe buffers for `ls-tree -z` to complete its dump.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
lib/browser.tcl | patch | blob | history |
diff --git a/lib/browser.tcl b/lib/browser.tcl
index 3d6341bcc53d0e61b0817dcc5d9778f714b026b9..e612247c9eca4287f372c317260d82383133e419 100644 (file)
--- a/lib/browser.tcl
+++ b/lib/browser.tcl
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
}
method _ls {tree_id {name {}}} {
- set browser_buffer {}
+ set ls_buf {}
set browser_files {}
set browser_busy 1
}
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 {
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