Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Eric Raible <raible@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: ':/<oneline prefix>' notation doesn't support full file syntax
Date: Thu, 3 Jul 2008 13:38:57 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0807031333150.9925@racer> (raw)
In-Reply-To: <279b37b20807030150t2e9cbcc8wf099a5872568af8@mail.gmail.com>

Hi,

On Thu, 3 Jul 2008, Eric Raible wrote:

> On Thu, Jul 3, 2008 at 1:34 AM, Junio C Hamano <gitster@pobox.com> wrote:
> > "Eric Raible" <raible@gmail.com> 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

  reply	other threads:[~2008-07-03 12:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-03  5:42 ':/<oneline prefix>' notation doesn't support full file syntax Eric Raible
2008-07-03  8:34 ` Junio C Hamano
2008-07-03  8:50   ` Eric Raible
2008-07-03 12:38     ` Johannes Schindelin [this message]
2008-07-03 18:27     ` Dana How
2008-07-03 21:26       ` Junio C Hamano
2008-07-04  0:14         ` Johannes Schindelin
2008-07-04  0:33       ` Johannes Schindelin
2008-07-03 10:47 ` Jeff King

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=alpine.DEB.1.00.0807031333150.9925@racer \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=raible@gmail.com \
    /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