From 8af52d7a83a78c5f3a60d5bd5099a5073655339a Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 20 Oct 2007 01:42:01 -0400 Subject: git-gui: Correctly report failures from git-write-tree If git-write-tree fails (such as if the index file is currently locked and it wants to write to it) we were not getting the error message as $tree_id was always the empty string so we shortcut through the catch and never got the output from stderr. Signed-off-by: Shawn O. Pearce diff --git a/lib/commit.tcl b/lib/commit.tcl index f857a2f..5723812 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -253,7 +253,7 @@ proc commit_committree {fd_wt curHEAD msg} { global repo_config gets $fd_wt tree_id - if {$tree_id eq {} || [catch {close $fd_wt} err]} { + if {[catch {close $fd_wt} err]} { error_popup "write-tree failed:\n\n$err" ui_status {Commit failed.} unlock_index -- cgit v0.10.2-6-g49f6 From bea6878be2fb73e50407f93f2bcd71b961510c19 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 20 Oct 2007 14:16:15 -0400 Subject: git-gui: Handle progress bars from newer gits Post Git 1.5.3 a new style progress bar has been introduced that uses only one line rather than two. The formatting of the completed and total section is also slightly different so we must adjust our regexp to match. Unfortunately both styles are in active use by different versions of Git so we need to look for both. Signed-off-by: Shawn O. Pearce diff --git a/lib/status_bar.tcl b/lib/status_bar.tcl index 72a8fe1..3bf79eb 100644 --- a/lib/status_bar.tcl +++ b/lib/status_bar.tcl @@ -69,7 +69,10 @@ method update_meter {buf} { set prior [string range $meter 0 $r] set meter [string range $meter [expr {$r + 1}] end] - if {[regexp "\\((\\d+)/(\\d+)\\)\\s+done\r\$" $prior _j a b]} { + set p "\\((\\d+)/(\\d+)\\)" + if {[regexp ":\\s*\\d+% $p\(?:, done.\\s*\n|\\s*\r)\$" $prior _j a b]} { + update $this $a $b + } elseif {[regexp "$p\\s+done\r\$" $prior _j a b]} { update $this $a $b } } -- cgit v0.10.2-6-g49f6 From bbbadf6e58f72ac6bf739d2a1109cbd872eb1083 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sat, 20 Oct 2007 20:42:01 -0400 Subject: git-gui: Don't display CR within console windows Git progress bars from tools like git-push and git-fetch use CR to skip back to the start of the current line and redraw it with an updated progress. We were doing this in our Tk widget but had failed to skip the CR, which Tk doesn't draw well. Signed-off-by: Shawn O. Pearce diff --git a/lib/console.tcl b/lib/console.tcl index 6f718fb..b038a78 100644 --- a/lib/console.tcl +++ b/lib/console.tcl @@ -122,7 +122,7 @@ method _read {fd after} { } else { $w.m.t delete $console_cr end $w.m.t insert end "\n" - $w.m.t insert end [string range $buf $c $cr] + $w.m.t insert end [string range $buf $c [expr {$cr - 1}]] set c $cr incr c } -- cgit v0.10.2-6-g49f6