From 38cda0b0decd135fea7fcfc7fce75ab62e819c09 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 50773a3d9d..2815f04328 100644 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -9399,7 +9399,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 -- 2.11.4.GIT