lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ':/<oneline prefix>' notation doesn't support full file syntax
- Date: Thu, 3 Jul 2008 13:38:57 +0100 (BST)
- From: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
- Subject: Re: ':/<oneline prefix>' notation doesn't support full file syntax
Hi,
On Thu, 3 Jul 2008, Eric Raible wrote:
> On Thu, Jul 3, 2008 at 1:34 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> > "Eric Raible" <raible@xxxxxxxxx> writes:
> >
> > Is there anything to fix? In that example, you are looking for a
> > commit that talks about "object name:sha1_name.c" in the comment.
>
> Yes. What if I'm looking for specific file (i.e. sha1_name.c) in the
> commit described by ":/object name:", just like I can do with
> 28a4d9404:sha1_name.c?
>
> This is not ambiguous if we first consider the entire string as the
> prefix. If that fails we look for a filename after the final ':'.
It is super-expensive, as you have to look through the whole history just
to find that you do not find anything.
And then, it could be that you do find a commit that starts with that
string, but what you really wanted it a file, not a commit.
And then, a file name can contain colons. What to do in that case?
I think your "fix" is not worth it. ":/<oneline>" is to help you find a
commit, and it will only ever find the first commit anyway, so you are
probably better off using
$ git show $(git log --pretty=format:%H:path/to/file.c \
--grep=^<oneline>)
to begin with.
Really, the only reason I ever wrote support for ":/blah" is when someone
less-than-helpful says "In commit 'Bla bla bla' you broke XYZ" and I want
to
$ git show :/Bla
Nowadays, however, I would
$ git log -p --grep=^Bla
so I'd vote to remove the ":/" syntax altogether. We need not even
concern ourselves with scripts using that syntax, since the semantics are
so limited that nobody should use it in scripts anyway.
Ciao,
Dscho
--
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