gitk: Second try to work around the command line limit on Windows

The first fix caused Tcl to fail to compile the regexp, see msysGit issue
427. Here is another fix without using regexp, and using a more relaxed
command line length limit to fix the original issue 387.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
This commit is contained in:
Sebastian Schuberth
2010-03-10 11:56:19 +01:00
committed by Johannes Schindelin
parent f9c077789e
commit 594bac3e46

View File

@@ -9418,11 +9418,16 @@ proc getallcommits {} {
}
if {$ids ne {}} {
set cmd [concat $cmd $ids]
# XP and later accept up to 8191 characters in the command line
# see http://support.microsoft.com/kb/830473
# The maximum command line length for the CreateProcess function is 32767 characters, see
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
if {[tk windowingsystem] == "win32" &&
[string length $cmd] > 8191} {
set cmd [regsub "^(.{1,8191}) .*\$" $cmd "\\1"]
[string length $cmd] > 32000} {
set ndx [string last " " $cmd 32000]
if {$ndx != -1} {
set cmd [string range $cmd 0 $ndx]
}
}
set fd [open $cmd r]
fconfigure $fd -blocking 0