Skip to content

Commit 233535e

Browse files
authored
Merge pull request #2170 from dscho/gitk-long-cmdline
Fix gitk (long cmdline)
2 parents 231c608 + b62ef9c commit 233535e

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

gitk-git/gitk

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,16 @@ proc start_rev_list {view} {
406406
if {$revs eq {}} {
407407
return 0
408408
}
409-
set args [limit_arg_length [concat $vflags($view) $revs]]
409+
set args $vflags($view)
410410
} else {
411+
set revs {}
411412
set args $vorigargs($view)
412413
}
413414

414415
if {[catch {
415416
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
416-
--parents --boundary $args "--" $files] r]
417+
--parents --boundary $args --stdin \
418+
"<<[join [concat $revs "--" $files] "\\n"]"] r]
417419
} err]} {
418420
error_popup "[mc "Error executing git log:"] $err"
419421
return 0
@@ -555,13 +557,19 @@ proc updatecommits {} {
555557
set revs $newrevs
556558
set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
557559
}
558-
set args [concat $vflags($view) $revs --not $oldpos]
560+
set args $vflags($view)
561+
foreach r $oldpos {
562+
lappend revs "^$r"
563+
}
559564
} else {
565+
set revs {}
560566
set args $vorigargs($view)
561567
}
562568
if {[catch {
563569
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
564-
--parents --boundary $args "--" $vfilelimit($view)] r]
570+
--parents --boundary $args --stdin \
571+
"<<[join [concat $revs "--" \
572+
$vfilelimit($view)] "\\n"]"] r]
565573
} err]} {
566574
error_popup "[mc "Error executing git log:"] $err"
567575
return
@@ -10174,10 +10182,15 @@ proc getallcommits {} {
1017410182
foreach id $seeds {
1017510183
lappend ids "^$id"
1017610184
}
10185+
lappend ids "--"
1017710186
}
1017810187
}
1017910188
if {$ids ne {}} {
10180-
set cmd [limit_arg_length [concat $cmd $ids]]
10189+
if {$ids eq "--all"} {
10190+
set cmd [concat $cmd "--all"]
10191+
} else {
10192+
set cmd [concat $cmd --stdin "<<[join $ids "\\n"]"]
10193+
}
1018110194
set fd [open $cmd r]
1018210195
fconfigure $fd -blocking 0
1018310196
incr allcommits
@@ -10188,21 +10201,6 @@ proc getallcommits {} {
1018810201
}
1018910202
}
1019010203

10191-
# The maximum command line length for the CreateProcess function is 32767 characters, see
10192-
# http://blogs.msdn.com/oldnewthing/archive/2003/12/10/56028.aspx
10193-
# Be a little conservative in case Tcl adds some more stuff to the command line we do not
10194-
# know about and truncate the command line at a SHA1-boundary below 32000 characters.
10195-
proc limit_arg_length {cmd} {
10196-
if {[tk windowingsystem] == "win32" &&
10197-
[string length $cmd] > 32000} {
10198-
set ndx [string last " " $cmd 32000]
10199-
if {$ndx != -1} {
10200-
return [string range $cmd 0 $ndx]
10201-
}
10202-
}
10203-
return $cmd
10204-
}
10205-
1020610204
# Since most commits have 1 parent and 1 child, we group strings of
1020710205
# such commits into "arcs" joining branch/merge points (BMPs), which
1020810206
# are commits that either don't have 1 parent or don't have 1 child.

0 commit comments

Comments
 (0)