git-gui: Handle progress bars from newer gits
authorShawn O. Pearce <spearce@spearce.org>
Sat, 20 Oct 2007 18:16:15 +0000 (14:16 -0400)
committerShawn O. Pearce <spearce@spearce.org>
Sun, 21 Oct 2007 00:36:27 +0000 (20:36 -0400)
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 <spearce@spearce.org>
lib/status_bar.tcl
index 72a8fe1fd36932efcb1e2f2e18e4200150436854..3bf79eb6e0608560d00aab82bc1d691db83881af 100644 (file)
@@ -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
        }
 }