From: Pat Thoyts Date: Fri, 18 Sep 2009 14:03:03 +0000 (+0100) Subject: Avoid command-line limits when executing git rev-parse on windows. X-Git-Url: http://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=09af55b6715c6d4367d6213fba1a0b4a8e28d10a;p=gitk Avoid command-line limits when executing git rev-parse on windows. This patch solves the problem handling large numbers of references reported by John Murphy that is due to limits in executing processes in Windows by reading the rev-parse result over a pipe. Signed-off-by: Pat Thoyts --- diff --git a/gitk b/gitk index a0214b7..f14ed2e 100755 --- a/gitk +++ b/gitk @@ -236,13 +236,23 @@ proc parseviewargs {n arglist} { return $allknown } +proc git-rev-parse {args} { + set ids {} + set pipe [open |[linsert $args 0 git rev-parse] r] + while {[gets $pipe line] != -1} { + lappend ids $line + } + close $pipe + return $ids +} + proc parseviewrevs {view revs} { global vposids vnegids if {$revs eq {}} { set revs HEAD } - if {[catch {set ids [eval exec git rev-parse $revs]} err]} { + if {[catch {set ids [git-rev-parse $revs]} err]} { # we get stdout followed by stderr in $err # for an unknown rev, git rev-parse echoes it and then errors out set errlines [split $err "\n"] @@ -273,7 +283,7 @@ proc parseviewrevs {view revs} { set pos {} set neg {} set sdm 0 - foreach id [split $ids "\n"] { + foreach id $ids { if {$id eq "--gitk-symmetric-diff-marker"} { set sdm 4 } elseif {[string match "^*" $id]} {