git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gitk does not show path file list
@ 2009-11-17 12:09 Mark Blakeney
  2009-11-24  5:36 ` Mark Blakeney
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Blakeney @ 2009-11-17 12:09 UTC (permalink / raw)
  To: git

gitk takes a path to limit commits to those touching those files.
However, doing "gitk ." does not list any files in the right window
file list when trying to view commits for the current dir (which would
seem to be a common use-case, particularly for me at least). Why is
the affected [subset] of files not shown?

Just seems to be a bug to this newbie, particularly when it does work
as I expect if I do a "cd .." and then "gitk src" where src was my
original dir. I'm using version 1.6.5.3 now but this has existed since
I started with git quite some time ago.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gitk does not show path file list
  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
  2009-11-24  7:57   ` Johannes Sixt
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Blakeney @ 2009-11-24  5:36 UTC (permalink / raw)
  To: git

This seems to me to be a straight out bug but given I've had no response here
and  given this is such a simple issue then I guess it's not a bug and I'm just
missing something? Please somebody, 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!?

Is there a more appropriate forum/list for git newcomers?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gitk does not show path file list
  2009-11-24  5:36 ` Mark Blakeney
@ 2009-11-24  7:22   ` Junio C Hamano
  2009-11-24  7:57   ` Johannes Sixt
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2009-11-24  7:22 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git, Mark Blakeney

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gitk does not show path file list
  2009-11-24  5:36 ` Mark Blakeney
  2009-11-24  7:22   ` Junio C Hamano
@ 2009-11-24  7:57   ` Johannes Sixt
  2009-11-24  8:11     ` Junio C Hamano
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Sixt @ 2009-11-24  7:57 UTC (permalink / raw)
  To: Mark Blakeney; +Cc: git

Mark Blakeney schrieb:
> This seems to me to be a straight out bug but given I've had no response here
> and  given this is such a simple issue then I guess it's not a bug and I'm just
> missing something? Please somebody, 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!?

gitk doesn't list the files in your examples because the patterns you gave
are not initial substrings of any files in the list.

-- Hannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gitk does not show path file list
  2009-11-24  7:57   ` Johannes Sixt
@ 2009-11-24  8:11     ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2009-11-24  8:11 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Mark Blakeney, git

Johannes Sixt <j.sixt@viscovery.net> writes:

> Mark Blakeney schrieb:
>> This seems to me to be a straight out bug but given I've had no response here
>> and  given this is such a simple issue then I guess it's not a bug and I'm just
>> missing something? Please somebody, 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!?
>
> gitk doesn't list the files in your examples because the patterns you gave
> are not initial substrings of any files in the list.

Yes, but if you are in src/ and run "gitk .", then...

 - clicking on a commit runs "diff-tree $commit .", that lists
   src/hello.c, src/goodbye.c, etc.

 - gitk tries to filter paths read from diff-tree with the "." given from
   the command line as the filter---it removes paths that do not match.

So the only case that would produce any output would be for you to have:

 src/src/hello.c
 src/frotz.c

and run

 cd src && gitk src

whose invocation of "diff-tree src" will show _only_ src/src/hello.c and
then the filter procedure will limit it to whatever begins with src/
(which would be everything).

That does not sound very useful to me...

   

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-11-24  8:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-11-24  7:57   ` Johannes Sixt
2009-11-24  8:11     ` Junio C Hamano

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).