Skip to content

Commit e07d36d

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

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
@@ -406,7 +406,7 @@ proc start_rev_list {view} {
406406
if {$revs eq {}} {
407407
return 0
408408
}
409-
set args [concat $vflags($view) $revs]
409+
set args [limit_arg_length [concat $vflags($view) $revs]]
410410
} else {
411411
set args $vorigargs($view)
412412
}
@@ -10057,18 +10057,7 @@ proc getallcommits {} {
1005710057
}
1005810058
}
1005910059
if {$ids ne {}} {
10060-
set cmd [concat $cmd $ids]
10061-
# The maximum command line length for the CreateProcess function is 32767 characters, see
10062-
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
10063-
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
10064-
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
10065-
if {[tk windowingsystem] == "win32" &&
10066-
[string length $cmd] > 32000} {
10067-
set ndx [string last " " $cmd 32000]
10068-
if {$ndx != -1} {
10069-
set cmd [string range $cmd 0 $ndx]
10070-
}
10071-
}
10060+
set cmd [limit_arg_length [concat $cmd $ids]]
1007210061
set fd [open $cmd r]
1007310062
fconfigure $fd -blocking 0
1007410063
incr allcommits
@@ -10079,6 +10068,21 @@ proc getallcommits {} {
1007910068
}
1008010069
}
1008110070

10071+
# The maximum command line length for the CreateProcess function is 32767 characters, see
10072+
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
10073+
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
10074+
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
10075+
proc limit_arg_length {cmd} {
10076+
if {[tk windowingsystem] == "win32" &&
10077+
[string length $cmd] > 32000} {
10078+
set ndx [string last " " $cmd 32000]
10079+
if {$ndx != -1} {
10080+
return [string range $cmd 0 $ndx]
10081+
}
10082+
}
10083+
return $cmd
10084+
}
10085+
1008210086
# Since most commits have 1 parent and 1 child, we group strings of
1008310087
# such commits into "arcs" joining branch/merge points (BMPs), which
1008410088
# are commits that either don't have 1 parent or don't have 1 child.

0 commit comments

Comments
 (0)