Re: [PATCH 0/5] gitweb: Improve search code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Admin note: Should I have changed the subject or kept it?

On 06/22/2011 11:28 AM, Jakub Narebski wrote:
> P.S. Another addition that I sometimes wanted git to have would be
> 'filename' or 'find' search: searching for file by name.
>
> What do you think of it?

I like it.  +1 from me.

I normally revert to 'git log --name-status | less <CR> /filename.foo',
which is awful, of course.  I've always assumed there's a better way I
haven't discovered yet.  But if there is, well... I haven't discovered
it yet.

This syntax works on some files, but is limited and/or broken:
   # Finds all commits touching the file named './foo.bar', iff
./foo.bar exists in the current commit.
   git log -- foo.bar

I say 'broken', but maybe it's not; it feels like it is when I do this:

   # Returns zero logs
   git log -- some-deleted-file.txt

   # Returns at least two logs
   git log --all -- some-deleted-file.txt

I think I understand why that happens (search optimization), but it is
unexpected from the user's perspective.  I also suspect it will miss the
'pre-resurrection' commits for files which were deleted and resurrected
in the past.


What do you think of these as new 'Commit limiters' for git log:

       --name=<pattern>, --name-glob=<glob>
           Limit the commits output to ones touching files that match the
           specified pattern (regular expression) or glob (shell glob
pattern).

This could be further modified by --diff-filter, --all-match, etc.

   # Find all commits which deleted a file named **/foo.**
   git log --name="/foo[.]" --diff-filter=D

   # Find all commits which deleted a file named **/foo.**
   #   or one named **/bar.**
   git log --name="/foo[.]" --name="/bar[.]" --diff-filter=D

   # Find all commits which touched both a file named **/foo.**
   #   and one named **/bar.**
   git log --name="/foo[.]" --name="/bar[.]" --all-match


Or this alternate form:

       --name-pattern, --name-glob
           Treat all <path> selectors as pattern (regular expression) or
glob (shell glob pattern).

I think I prefer the former, since the latter does not allow for a
combination of raw names, pattern names and glob names.  Also, it does
not (intuitively) support --all-match.

   # Find all commits which deleted a file named **/foo.**
   git log --name-pattern --diff-filter=D -- "/foo[.]"
   git log --name-glob --diff-filter=D -- "/foo.*"

   # Find all commits which deleted a file named **/foo.**
   #   or one named **/bar.**
   git log --name-pattern --diff-filter=D -- "/foo[.]" "/bar[.]"

   # Find all commits which touched both a file named **/foo.**
   #   and one named **/bar.**
   #  -- Can't be done?

Finally, do the extensions belong on rev-list as well?  The 'git
rev-list' command seems underpowered compared to 'git log'.

Phil
--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]