gitk: work around ridiculous command line restriction on Windows

On Windows, there are dramatic problems when a command line grows
beyond PATH_MAX, which is restricted to 8191 characters on XP and
later (according to http://support.microsoft.com/kb/830473).

Work around this by just cutting off the command line at that length
(actually, at a space boundary) in the hope that only negative
refs are chucked: gitk will then do unnecessary work, but that is
still better than flashing the gitk window and exiting with exit
status 5 (which no Windows user is able to make sense of).

This fixes msysGit issue 387.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2009-08-11 02:22:33 +02:00
parent 959d8d90b7
commit f9c077789e

View File

@@ -9417,7 +9417,14 @@ proc getallcommits {} {
}
}
if {$ids ne {}} {
set fd [open [concat $cmd $ids] r]
set cmd [concat $cmd $ids]
# XP and later accept up to 8191 characters in the command line
# see http://support.microsoft.com/kb/830473
if {[tk windowingsystem] == "win32" &&
[string length $cmd] > 8191} {
set cmd [regsub "^(.{1,8191}) .*\$" $cmd "\\1"]
}
set fd [open $cmd r]
fconfigure $fd -blocking 0
incr allcommits
nowbusy allcommits