Re: [PATCH] gitk: refresh the index before running diff-files
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:53
Jeff King [off-list ref] writes:
Potentially the "reload" command should reset the need_index_refresh flag, too.
Yeah, I think that is a sane enhancement to think about.
quoted hunk
gitk | 10 ++++++++++ 1 file changed, 10 insertions(+)diff --git a/gitk b/gitk index 379582a..561be23 100755 --- a/gitk +++ b/gitk@@ -5112,6 +5112,14 @@ proc dodiffindex {} { filerun $fd [list readdiffindex $fd $lserial $i] } +proc refresh_index {} { + global need_index_refresh + if { $need_index_refresh } { + exec sh -c "git update-index --refresh >/dev/null 2>&1 || true" + set need_index_refresh false + } +} + proc readdiffindex {fd serial inst} { global viewmainheadid nullid nullid2 curview commitinfo commitdata lserial global vfilelimit@@ -5131,6 +5139,7 @@ proc readdiffindex {fd serial inst} { } # now see if there are any local changes not checked in to the index + refresh_index set cmd "|git diff-files" if {$vfilelimit($curview) ne {}} { set cmd [concat $cmd -- $vfilelimit($curview)]@@ -11670,6 +11679,7 @@ set want_ttk 1 set autosellen 40 set perfile_attrs 0 set want_ttk 1 +set need_index_refresh true if {[tk windowingsystem] eq "aqua"} { set extdifftool "opendiff"