Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 41 additions & 4 deletions gitk-git/gitk
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,51 @@ proc getcommits {selid} {
}
}

proc updatecommits_command {args oldpos view} {
global have_tk86 show_notes vfilelimit

set command_head [concat git log --no-color -z --pretty=raw $show_notes --parents --boundary $args]

if {!$have_tk86} {
# "chan pipe" is added in tcl 8.6
return [open [concat | $command_head --not $oldpos -- $vfilelimit($view)] r]
} else {
set pIn [chan pipe]
set pOut [chan pipe]
set child [exec sh -c [concat $command_head --stdin] <@ [lindex $pIn 0] >@ [lindex $pOut 1] &]
close [lindex $pIn 0]
close [lindex $pOut 1]

foreach arg $oldpos {
if {![regexp {[0-9a-f]{16}} $arg]} {
puts "oops: unexpected refspec to ignore (only hashes are expected): $arg"
}
puts [lindex $pIn 1] "^$arg"
}
puts [lindex $pIn 1] "--"
foreach file_arg $vfilelimit($view) {
if {[string first "\n" $file_arg] > -1} {
# --stdin gets each line as argument, no quoting required
# this approach seems to miss newlines in file name
# which is unlikely
puts "oops: newlines in file names not supported"
} else {
puts [lindex $pIn 1] $file_arg
}
}
close [lindex $pIn 1]

return [lindex $pOut 0]
}
}

proc updatecommits {} {
global curview vcanopt vorigargs vfilelimit viewinstances
global viewactive viewcomplete tclencoding
global startmsecs showneartags showlocalchanges
global mainheadid viewmainheadid viewmainheadid_orig pending_select
global hasworktree
global varcid vposids vnegids vflags vrevs
global show_notes

set hasworktree [hasworktree]
rereadrefs
Expand Down Expand Up @@ -555,13 +592,13 @@ proc updatecommits {} {
set revs $newrevs
set vposids($view) [lsort -unique [concat $oldpos $vposids($view)]]
}
set args [concat $vflags($view) $revs --not $oldpos]
set args [concat $vflags($view) $revs]
} else {
set args $vorigargs($view)
set oldpos {}
}
if {[catch {
set fd [open [concat | git log --no-color -z --pretty=raw $show_notes \
--parents --boundary $args "--" $vfilelimit($view)] r]
set fd [updatecommits_command $args $oldpos $view]
} err]} {
error_popup "[mc "Error executing git log:"] $err"
return
Expand Down