Skip to content

Commit c94dc35

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge pull request #2170 from dscho/gitk-long-cmdline
Fix gitk (long cmdline)
2 parents 6daa3e3 + 515dc94 commit c94dc35

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
@@ -354,6 +354,16 @@ proc parseviewrevs {view revs} {
354354
return $ret
355355
}
356356

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

414425
if {[catch {
415426
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
416-
--parents --boundary $args "--" $files] r]
427+
--parents --boundary $args --stdin \
428+
"<<[join [concat $revs "--" \
429+
[escape_filter_paths $files]] "\\n"]"] r]
417430
} err]} {
418431
error_popup "[mc "Error executing git log:"] $err"
419432
return 0
@@ -555,13 +568,20 @@ proc updatecommits {} {
555568
set revs $newrevs
556569
set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
557570
}
558-
set args [concat $vflags($view) $revs --not $oldpos]
571+
set args $vflags($view)
572+
foreach r $oldpos {
573+
lappend revs "^$r"
574+
}
559575
} else {
576+
set revs {}
560577
set args $vorigargs($view)
561578
}
562579
if {[catch {
563580
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
564-
--parents --boundary $args "--" $vfilelimit($view)] r]
581+
--parents --boundary $args --stdin \
582+
"<<[join [concat $revs "--" \
583+
[escape_filter_paths \
584+
$vfilelimit($view)]] "\\n"]"] r]
565585
} err]} {
566586
error_popup "[mc "Error executing git log:"] $err"
567587
return
@@ -10210,10 +10230,16 @@ proc getallcommits {} {
1021010230
foreach id $seeds {
1021110231
lappend ids "^$id"
1021210232
}
10233+
lappend ids "--"
1021310234
}
1021410235
}
1021510236
if {$ids ne {}} {
10216-
set fd [open [concat $cmd $ids] r]
10237+
if {$ids eq "--all"} {
10238+
set cmd [concat $cmd "--all"]
10239+
} else {
10240+
set cmd [concat $cmd --stdin "<<[join $ids "\\n"]"]
10241+
}
10242+
set fd [open $cmd r]
1021710243
fconfigure $fd -blocking 0
1021810244
incr allcommits
1021910245
nowbusy allcommits

0 commit comments

Comments
 (0)