From 4a034803db43183ad347092fcb6a34ce5dbac367 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 11 Aug 2009 02:22:33 +0200 Subject: [PATCH] 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 --- gitk-git/gitk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index cdedaa7121..a22888c862 100644 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -9397,7 +9397,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