git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
Cc: "Patrick Steinhardt" <ps@pks.im>,
	 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, 06 Dec 2024 20:57:04 +0900	[thread overview]
Message-ID: <xmqqcyi5vxbj.fsf@gitster.g> (raw)
In-Reply-To: <9c7b9090-8cf2-4095-8e86-2c85b6fe407f@app.fastmail.com> (Kristoffer Haugsbakk's message of "Fri, 06 Dec 2024 12:20:45 +0100")

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

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>

Thanks.

  reply	other threads:[~2024-12-06 11:57 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 [this message]
2024-12-06 12:05     ` Patrick Steinhardt
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=xmqqcyi5vxbj.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=aarni@valohai.com \
    --cc=git@vger.kernel.org \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=peff@peff.net \
    --cc=ps@pks.im \
    /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).