Skip to content

Commit 7b43106

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #2170 from dscho/gitk-long-cmdline
Fix gitk (long cmdline)
2 parents 6484212 + 0ca2a96 commit 7b43106

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

gitk-git/gitk

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,16 @@ proc parseviewrevs {view revs} {
353353
return $ret
354354
}
355355

356+
# Escapes a list of filter paths to be passed to git log via stdin. Note that
357+
# paths must not be quoted.
358+
proc escape_filter_paths {paths} {
359+
set escaped [list]
360+
foreach path $paths {
361+
lappend escaped [string map {\\ \\\\ "\ " "\\\ "} $path]
362+
}
363+
return $escaped
364+
}
365+
356366
# Start off a git log process and arrange to read its output
357367
proc start_rev_list {view} {
358368
global startmsecs commitidx viewcomplete curview
@@ -405,14 +415,17 @@ proc start_rev_list {view} {
405415
if {$revs eq {}} {
406416
return 0
407417
}
408-
set args [concat $vflags($view) $revs]
418+
set args $vflags($view)
409419
} else {
420+
set revs {}
410421
set args $vorigargs($view)
411422
}
412423

413424
if {[catch {
414425
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
415-
--parents --boundary $args "--" $files] r]
426+
--parents --boundary $args --stdin \
427+
"<<[join [concat $revs "--" \
428+
[escape_filter_paths $files]] "\\n"]"] r]
416429
} err]} {
417430
error_popup "[mc "Error executing git log:"] $err"
418431
return 0
@@ -554,13 +567,20 @@ proc updatecommits {} {
554567
set revs $newrevs
555568
set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
556569
}
557-
set args [concat $vflags($view) $revs --not $oldpos]
570+
set args $vflags($view)
571+
foreach r $oldpos {
572+
lappend revs "^$r"
573+
}
558574
} else {
575+
set revs {}
559576
set args $vorigargs($view)
560577
}
561578
if {[catch {
562579
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
563-
--parents --boundary $args "--" $vfilelimit($view)] r]
580+
--parents --boundary $args --stdin \
581+
"<<[join [concat $revs "--" \
582+
[escape_filter_paths \
583+
$vfilelimit($view)]] "\\n"]"] r]
564584
} err]} {
565585
error_popup "[mc "Error executing git log:"] $err"
566586
return
@@ -10228,10 +10248,16 @@ proc getallcommits {} {
1022810248
foreach id $seeds {
1022910249
lappend ids "^$id"
1023010250
}
10251+
lappend ids "--"
1023110252
}
1023210253
}
1023310254
if {$ids ne {}} {
10234-
set fd [open [concat $cmd $ids] r]
10255+
if {$ids eq "--all"} {
10256+
set cmd [concat $cmd "--all"]
10257+
} else {
10258+
set cmd [concat $cmd --stdin "<<[join $ids "\\n"]"]
10259+
}
10260+
set fd [open $cmd r]
1023510261
fconfigure $fd -blocking 0
1023610262
incr allcommits
1023710263
nowbusy allcommits

0 commit comments

Comments
 (0)