Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ffa28b4

Browse files
FauxFauxkblees
authored andcommitted
Fix another invocation of git from gitk with an overly long command-line
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent efd5f2a commit ffa28b4

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

gitk-git/gitk

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ proc start_rev_list {view} {
404404
if {$revs eq {}} {
405405
return 0
406406
}
407-
set args [concat $vflags($view) $revs]
407+
set args [limit_arg_length [concat $vflags($view) $revs]]
408408
} else {
409409
set args $vorigargs($view)
410410
}
@@ -9969,18 +9969,7 @@ proc getallcommits {} {
99699969
}
99709970
}
99719971
if {$ids ne {}} {
9972-
set cmd [concat $cmd $ids]
9973-
# The maximum command line length for the CreateProcess function is 32767 characters, see
9974-
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
9975-
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
9976-
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
9977-
if {[tk windowingsystem] == "win32" &&
9978-
[string length $cmd] > 32000} {
9979-
set ndx [string last " " $cmd 32000]
9980-
if {$ndx != -1} {
9981-
set cmd [string range $cmd 0 $ndx]
9982-
}
9983-
}
9972+
set cmd [limit_arg_length [concat $cmd $ids]]
99849973
set fd [open $cmd r]
99859974
fconfigure $fd -blocking 0
99869975
incr allcommits
@@ -9991,6 +9980,21 @@ proc getallcommits {} {
99919980
}
99929981
}
99939982

9983+
# The maximum command line length for the CreateProcess function is 32767 characters, see
9984+
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
9985+
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
9986+
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
9987+
proc limit_arg_length {cmd} {
9988+
if {[tk windowingsystem] == "win32" &&
9989+
[string length $cmd] > 32000} {
9990+
set ndx [string last " " $cmd 32000]
9991+
if {$ndx != -1} {
9992+
return [string range $cmd 0 $ndx]
9993+
}
9994+
}
9995+
return $cmd
9996+
}
9997+
99949998
# Since most commits have 1 parent and 1 child, we group strings of
99959999
# such commits into "arcs" joining branch/merge points (BMPs), which
999610000
# are commits that either don't have 1 parent or don't have 1 child.

0 commit comments

Comments
 (0)