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

Commit d87a841

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

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
}
@@ -9934,18 +9934,7 @@ proc getallcommits {} {
99349934
}
99359935
}
99369936
if {$ids ne {}} {
9937-
set cmd [concat $cmd $ids]
9938-
# The maximum command line length for the CreateProcess function is 32767 characters, see
9939-
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
9940-
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
9941-
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
9942-
if {[tk windowingsystem] == "win32" &&
9943-
[string length $cmd] > 32000} {
9944-
set ndx [string last " " $cmd 32000]
9945-
if {$ndx != -1} {
9946-
set cmd [string range $cmd 0 $ndx]
9947-
}
9948-
}
9937+
set cmd [limit_arg_length [concat $cmd $ids]]
99499938
set fd [open $cmd r]
99509939
fconfigure $fd -blocking 0
99519940
incr allcommits
@@ -9956,6 +9945,21 @@ proc getallcommits {} {
99569945
}
99579946
}
99589947

9948+
# The maximum command line length for the CreateProcess function is 32767 characters, see
9949+
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
9950+
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
9951+
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
9952+
proc limit_arg_length {cmd} {
9953+
if {[tk windowingsystem] == "win32" &&
9954+
[string length $cmd] > 32000} {
9955+
set ndx [string last " " $cmd 32000]
9956+
if {$ndx != -1} {
9957+
return [string range $cmd 0 $ndx]
9958+
}
9959+
}
9960+
return $cmd
9961+
}
9962+
99599963
# Since most commits have 1 parent and 1 child, we group strings of
99609964
# such commits into "arcs" joining branch/merge points (BMPs), which
99619965
# are commits that either don't have 1 parent or don't have 1 child.

0 commit comments

Comments
 (0)