git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org, Mark Blakeney <markb@berlios.de>
Subject: Re: gitk does not show path file list
Date: Mon, 23 Nov 2009 23:22:01 -0800	[thread overview]
Message-ID: <7v3a44l752.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <loom.20091124T060334-836@post.gmane.org> (Mark Blakeney's message of "Tue\, 24 Nov 2009 05\:36\:37 +0000 \(UTC\)")

Mark Blakeney <markb@berlios.de> writes:

> ... why does gitk (usually) not show the subset list of files affected
> when you give it a path?
>
> E.g. If I am in a src dir then "gitk ." does not list files. Neither does "gitk
> $PWD" nor "gitk ../src". However "cd ..; git src" does list files!?

Paul, I do not read Tcl very well, but it appears that path_filter
procedure is at fault.

The call chain involved in this seems to be:

    gettreediffs
     - arranges gettreediffline to be fed output from "diff-tree $commit ."

 ->

    gettreediffline
     - finds the path (note that diff output is _always_ relative to the
       top of the work tree) from the patch;
     - calls path_filter with $vfilelimit($curview) and each filename
       In this case, the $vfilelimit($curview) is "." (dot)

 ->

    path_filter
     - compares strings in $filter and the $name; in this case, $filter is
       a dot "." and $name begins with "src/"

I see at least two problems in path_filter used this way:

 - A dot "." never would match anything from "diff-tree" (or any "diff"
   variant) after stripping a/ and b/ prefix.  gitk should prefix the
   current directory to each of the pathspec from command line (run
   "rev-parse --show-prefix" to learn where you are).

 - There is another callsite to path_filter for filtering output from
   "ls-files -u".  But the output from "ls-files" is relative to the cwd
   by default.  gitk should probably run it with --full-name option, so
   that it would get the same semantics as "diff" output.

It _might_ be the easiest to do an equivalent of (sorry, I do not talk Tcl
so this is in shell):

	prefix=$(git rev-parse --show-prefix)
	if test -n "$prefix"
        then
        	cd $(git rev-parse --show-cdup)
	fi

and then prepend prefix to all the pathspecs you would use from the
command line before doing anything else.  This "prepending" obviously need
to be aware of the ".", ".." and friends.

  reply	other threads:[~2009-11-24  7:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-17 12:09 gitk does not show path file list Mark Blakeney
2009-11-24  5:36 ` Mark Blakeney
2009-11-24  7:22   ` Junio C Hamano [this message]
2009-11-24  7:57   ` Johannes Sixt
2009-11-24  8:11     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v3a44l752.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=markb@berlios.de \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).