Skip to content

Commit 28999e7

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 783b636 commit 28999e7

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
}
@@ -10039,18 +10039,7 @@ proc getallcommits {} {
1003910039
}
1004010040
}
1004110041
if {$ids ne {}} {
10042-
set cmd [concat $cmd $ids]
10043-
# The maximum command line length for the CreateProcess function is 32767 characters, see
10044-
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
10045-
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
10046-
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
10047-
if {[tk windowingsystem] == "win32" &&
10048-
[string length $cmd] > 32000} {
10049-
set ndx [string last " " $cmd 32000]
10050-
if {$ndx != -1} {
10051-
set cmd [string range $cmd 0 $ndx]
10052-
}
10053-
}
10042+
set cmd [limit_arg_length [concat $cmd $ids]]
1005410043
set fd [open $cmd r]
1005510044
fconfigure $fd -blocking 0
1005610045
incr allcommits
@@ -10061,6 +10050,21 @@ proc getallcommits {} {
1006110050
}
1006210051
}
1006310052

10053+
# The maximum command line length for the CreateProcess function is 32767 characters, see
10054+
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
10055+
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
10056+
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
10057+
proc limit_arg_length {cmd} {
10058+
if {[tk windowingsystem] == "win32" &&
10059+
[string length $cmd] > 32000} {
10060+
set ndx [string last " " $cmd 32000]
10061+
if {$ndx != -1} {
10062+
return [string range $cmd 0 $ndx]
10063+
}
10064+
}
10065+
return $cmd
10066+
}
10067+
1006410068
# Since most commits have 1 parent and 1 child, we group strings of
1006510069
# such commits into "arcs" joining branch/merge points (BMPs), which
1006610070
# are commits that either don't have 1 parent or don't have 1 child.

0 commit comments

Comments
 (0)