git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	git@vger.kernel.org, Aarni Koskela <aarni@valohai.com>,
	Jeff King <peff@peff.net>
Subject: Re: [PATCH] object-name: fix reversed ordering with magic pathspecs
Date: Fri, 6 Dec 2024 13:05:24 +0100	[thread overview]
Message-ID: <Z1LohIVUyAOJvjW7@pks.im> (raw)
In-Reply-To: <xmqqcyi5vxbj.fsf@gitster.g>

On Fri, Dec 06, 2024 at 08:57:04PM +0900, Junio C Hamano wrote:
> "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com> writes:
> 
> > On Fri, Dec 6, 2024, at 10:51, Patrick Steinhardt wrote:
> >> It was reported
> >
> > It would be nice with a hyperlink since this email is not part of the
> > email thread for the report.
> >
> > https://lore.kernel.org/git/Z1LJSADiStlFicTL@pks.im/T/#mae906ec74d5657e702165e29b90927f730280c29
> >
> >> It was reported that magic pathspecs started to return results in
> >
> > I’m not used to this being called “magic pathspecs” as a user.
> > gitglossary(7) talks about (magic) pathspecs as filepaths.
> 
> Thanks for catching the mistaken phrasing.  It would have caused
> unnecessary confusion later to "git log" readers.
> 
> The syntax to say that the following path is from the top-level of
> the working tree even when you are running the command from a
> subdirectory, e.g.
> 
>     cd Documentation
>     git log :/t
> 
> is described in gitglossary(7):
> 
>     A pathspec that begins with a colon `:` has special meaning.  In the
>     short form, the leading colon `:` is followed by zero or more "magic
>     signature" letters (which optionally is terminated by another colon `:`),
>     and the remainder is the pattern to match against the path.
>     The "magic signature" consists of ASCII symbols that are neither
>     alphanumeric, glob, regex special characters nor colon.
>     The optional colon that terminates the "magic signature" can be
>     omitted if the pattern begins with a character that does not belong to
>     "magic signature" symbol set and is not a colon.
> 
> and even though the word "magic" signature is used, there is no
> definition given for the entire construct, i.e. the pathspec that
> uses a special meaning introduced by the use of "colon followed by
> one or more magic signature letters".  We probably should add a
> sentence to officially define it, if only to reduce the need for
> exchanges like this ;-)
> 
>     ... and is not a colon.  Such a pathspec that uses these "magic"
>     meaning is called "magic pathspec".
> 
> But more importantly, the syntax that triggered this topic in
> 
> <CAKOEJdcPYn3O01p29rVa+xv=Qr504FQyKJeSB-Moze04ViCGGg@mail.gmail.com>
> 
> is *NOT* a magic pathspec at all.  It is a revision syntax to name
> the first commit that is reachable from the current HEAD with a
> commit log message, that matches the given patterh, i.e.
> 
>     git show ":/my message"
> 
> which is a (rather lousy) short-hand for a more general
> 
>     git show "HEAD^{/my message}"
> 
> i.e. <startingRev>^{/<pattern>}.  There is no specific name for
> this syntax.

Hm, yeah. I think I read pathspec somewhere and just went with it
without thinking.

> I suspect that "filepath" you mentioned may be something some folks
> (but not me or any other long timers) would call yet another syntax,
> which is :<path>, that names the object sitting at <path> in the
> index.  Because ":/myMessage" look so similar to ":myFile", yet
> they mean so different things, as I said, ":/myMessage" is a rather
> lousy short-hand for the more general "^{/<pattern>}" suffix that
> is less ambiguous.
> 
> Patrick, let's not use a wrong word.  This is not about pathspec at
> all, and is a revision syntax.  As there is no specific jargon for
> the syntax, here is what I would write, if I were explaining the
> problem being solved:
> 
>     Recently it was reported [*1*] that "look for the youngest
>     reachable commit with log message that match the given pattern"
>     syntax (e.g. :/myMessagePattern, or HEAD^{/myMessagePattern})
>     started to show older commit.
> 
>     [Footnote]
>     *1* <CAKOEJdcPYn3O01p29rVa+xv=Qr504FQyKJeSB-Moze04ViCGGg@mail.gmail.com>

Will update in v2. Thanks!

Patrick

  reply	other threads:[~2024-12-06 12:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-06  9:51 [PATCH] object-name: fix reversed ordering with magic pathspecs Patrick Steinhardt
2024-12-06 11:20 ` Kristoffer Haugsbakk
2024-12-06 11:57   ` Junio C Hamano
2024-12-06 12:05     ` Patrick Steinhardt [this message]
2024-12-06 12:25     ` Kristoffer Haugsbakk
2024-12-06 22:40       ` Junio C Hamano
2024-12-06 12:25   ` Patrick Steinhardt
2024-12-06 12:28 ` [PATCH v2] object-name: fix reversed ordering with ":/<PATTERN>" revisions Patrick Steinhardt
2024-12-06 14:33   ` Kristoffer Haugsbakk
2024-12-06 15:45     ` Patrick Steinhardt
2024-12-06 22:46       ` Junio C Hamano
2024-12-07  2:05     ` Justin Tobler
2024-12-06 15:45 ` [PATCH v3] " Patrick Steinhardt
2024-12-07 15:51   ` Kristoffer Haugsbakk
2024-12-07 23:24     ` Junio C Hamano
2024-12-09 11:47   ` René Scharfe

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=Z1LohIVUyAOJvjW7@pks.im \
    --to=ps@pks.im \
    --cc=aarni@valohai.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=peff@peff.net \
    /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).