The "highlight this only" and "highlight this too" commands in gitk add the path relative to $GIT_WORK_TREE to the "Find" input box. When the search (using git-diff-tree) is run, the paths are used unmodified, except for some shell escaping. Since the search is run from gitk's working directory, no commits matching the paths will be found if gitk was started in a subdirectory. Make the paths passed to git-diff-tree relative to gitk's working directory instead of being relative to $GIT_WORK_TREE. If, however, gitk is run outside of the working directory (e.g. with $GIT_WORK_TREE set), we still need to use the path relative to $GIT_WORK_TREE. Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@xxxxxxxxx> --- This could also have been fixed by cd-ing to the work tree directory. That would also make the "Local changes checked in to index but not committed" and "Local uncommitted changes, not checked in to index" show up properly when running with GIT_WORK_TREE defined. I wasn't sure if other parts of gitk depend on the working directory, or if there are plans to make something depend on it, so I thought changing it only for the specific case of file highlighting would be safer. What do you think? gitk-git/gitk | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index e82c6bf..ce96294 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -4528,12 +4528,17 @@ proc makepatterns {l} { proc do_file_hl {serial} { global highlight_files filehighlight highlight_paths gdttype fhl_list + global cdup if {$gdttype eq [mc "touching paths:"]} { if {[catch {set paths [shellsplit $highlight_files]}]} return set highlight_paths [makepatterns $paths] highlight_filelist - set gdtargs [concat -- $paths] + set relative_paths {} + foreach path $paths { + lappend relative_paths [file join $cdup $path] + } + set gdtargs [concat -- $relative_paths] } elseif {$gdttype eq [mc "adding/removing string:"]} { set gdtargs [list "-S$highlight_files"] } else { @@ -11625,6 +11630,10 @@ set stuffsaved 0 set patchnum 0 set lserial 0 set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}] +set cdup {} +if {$isworktree} { + set cdup [exec git rev-parse --show-cdup] +} setcoords makewindow catch { -- 1.7.4.79.gcbe20 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html