From: ZheNing Hu <adlternative@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "René Scharfe" <l.s.r@web.de>,
"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>,
"Git List" <git@vger.kernel.org>, "Jeff King" <peff@peff.net>,
"Christian Couder" <chriscool@tuxfamily.org>,
"Hariom Verma" <hariom18599@gmail.com>
Subject: Re: [PATCH] [GSOC] ref-filter: add %(notes) format atom
Date: Mon, 3 May 2021 21:25:14 +0800 [thread overview]
Message-ID: <CAOLTT8R2-uZQ4rAs+TNKSZXzfXjjB-=unuBUykMo=taguTPw7A@mail.gmail.com> (raw)
In-Reply-To: <xmqqsg34a5j8.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年5月3日周一 上午10:57写道:
>
> ZheNing Hu <adlternative@gmail.com> writes:
>
> > Note that `cat-file --batch` should be a superset of `ref-filter` and
> > `--pretty`, because
> > it supports all objects, while `ref-filter` only supports "commit" and
> > "tag" two kinds
> > of objects, and `--pretty` only supports "commit" one kind of object.
>
> What? A ref can point at any kind of objects, not necessarily
> commits and tags. %(objectname), %(objecttype), etc. obviously
> are applicable to any type of object.
>
Thanks for correcting. I only saw tag and commit in the output
of `git for-each-ref` before, and blob and tree are not processed
in `grab_values` in `ref-filter.c`, which deepens my illusion.
`git update-ref` can make a ref point to a blob object or tree object,
although I don't know what these refs are used for... A reference to a
commit object makes sense, but if it is a blob, are there any suitable
scenarios?
> Another thing worth noting is that ref-filter needs to deal with
> traits that are not tied to any particular object, but to the ref
> itself, like who its upstream is and where it would be pushed to.
>
Indeed need to be considered "%(push)" "%(remote)" will change
"refname".
> > So it may be reasonable to provide `%(notes)` to "commit","tag"
> > objects in `cat-file --batch`
> > in the future, now integrate them into ref-filter firstly.
>
> And you can attach notes to objects of any type, not limited to
> commits and tags.
>
> >> > So in this patch, I tried to migrate --pretty=%N to --format=%(notes).
>
> What do you mean by "migrate"? Are you making both available?
>
Well, here are some incorrect statements, I just want to express that
the `--format="%(notes)"` implemented in "ref-filter" has the same semantics
as "--pretty=%N".
> >> > diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
> >> > index 2ae2478de706..07f037a16e13 100644
> >> > --- a/Documentation/git-for-each-ref.txt
> >> > +++ b/Documentation/git-for-each-ref.txt
> >> > @@ -139,6 +139,9 @@ deltabase::
> >> > given object, if it is stored as a delta. Otherwise it
> >> > expands to the null object name (all zeroes).
> >> >
> >> > +notes::
> >> > + The notes associated with the ref.
>
> "The notes associated with the object pointed at by the ref".
>
> A note is never associated with a ref. It can only associated with
> an object.
>
Indeed.
> If we are going to have %(notes), it may be natural to desire
> grabbing notes for the given object from specified notes ref, e.g.
>
> git for-each-ref --format="%(notes:amlog) %(subject)" zh/pretty-date-human
>
> may want to give the same kind of information as
>
> git show -s --format='%N %s' --notes=amlog zh/pretty-date-human
>
> The underlying notes machinery however may not be prepared to work
> with more than one notes tree at the same time, so
>
> git for-each-ref --format="%(notes) %(subject)" --notes=amlog zh/pretty-date-human
>
> might be a better syntax, as --format="%(notes:X) %(notes:Y)" may
> not be something you can easily support.
>
Here is a "bad" idea that might support this feature: use another subprocess
"git notes --refs=refs/notes/amlog" :)
Thanks.
--
ZheNing Hu
prev parent reply other threads:[~2021-05-03 13:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 10:24 [PATCH] [GSOC] ref-filter: add %(notes) format atom ZheNing Hu via GitGitGadget
2021-05-01 19:21 ` René Scharfe
2021-05-02 6:12 ` ZheNing Hu
2021-05-03 2:56 ` Junio C Hamano
2021-05-03 13:25 ` ZheNing Hu [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOLTT8R2-uZQ4rAs+TNKSZXzfXjjB-=unuBUykMo=taguTPw7A@mail.gmail.com' \
--to=adlternative@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=hariom18599@gmail.com \
--cc=l.s.r@web.de \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).