mbox series

[0/6,GSOC,RFC] ref-filter: add %(raw:textconv) and %(raw:filters)

Message ID pull.972.git.1622884415.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series ref-filter: add %(raw:textconv) and %(raw:filters) | expand

Message

Philippe Blain via GitGitGadget June 5, 2021, 9:13 a.m. UTC
In order to let git cat-file --batch reuse ref-filter logic, This patch,
%(rest), %(raw:textconv), %(raw:filters) atoms and --rest=<rest> option are
added to ref-filter.

 * %(rest) int the format will be replaced by the <rest> in --rest=<rest>.
 * the <rest> in --rest=<rest> can also be used as the <path> for
   %(raw:textconv) and %(raw:filters).
 * %(raw:textconv) can show the object's contents as transformed by a
   textconv filter.
 * %(raw:filters) can show the content as converted by the filters
   configured in the current working tree for the given <path> (i.e. smudge
   filters, end-of-line conversion, etc).

The current series is based on 0efed9435 ([GSOC] ref-filter: add %(raw)
atom)
https://lore.kernel.org/git/pull.966.v2.git.1622808751.gitgitgadget@gmail.com/
If necessary, "%(rest)" part can be an independent patch later.

ZheNing Hu (6):
  [GSOC] ref-filter: add obj-type check in grab contents
  [GSOC] ref-filter: add %(raw) atom
  [GSOC] ref-filter: use non-const ref_format in *_atom_parser()
  [GSOC] ref-filter: add %(rest) atom and --rest option
  [GSOC] ref-filter: teach grab_sub_body_contents() return value and err
  [GSOC] ref-filter: add %(raw:textconv) and %(raw:filters)

 Documentation/git-branch.txt       |   6 +-
 Documentation/git-for-each-ref.txt |  29 ++-
 Documentation/git-tag.txt          |   4 +
 Documentation/git-verify-tag.txt   |   6 +-
 builtin/branch.c                   |   5 +
 builtin/for-each-ref.c             |  17 +-
 builtin/tag.c                      |   8 +-
 builtin/verify-tag.c               |   1 +
 ref-filter.c                       | 296 ++++++++++++++++++++++-------
 ref-filter.h                       |   9 +-
 t/t3203-branch-output.sh           |  14 ++
 t/t6300-for-each-ref.sh            | 294 ++++++++++++++++++++++++++++
 t/t7004-tag.sh                     |  10 +
 t/t7030-verify-tag.sh              |   8 +
 14 files changed, 633 insertions(+), 74 deletions(-)


base-commit: 1197f1a46360d3ae96bd9c15908a3a6f8e562207
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-972%2Fadlternative%2Fref-filter-texconv-filters-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-972/adlternative/ref-filter-texconv-filters-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/972

Comments

Bagas Sanjaya June 5, 2021, 10:29 a.m. UTC | #1
Hi,

On 05/06/21 16.13, ZheNing Hu via GitGitGadget wrote:
> In order to let git cat-file --batch reuse ref-filter logic, This patch,
> %(rest), %(raw:textconv), %(raw:filters) atoms and --rest=<rest> option are
> added to ref-filter.
> 

Better say "Add ... atoms and --rest=<rest> option to ref-filter, in 
order to let git cat-file reuse ref-filter logic."

>   * %(rest) int the format will be replaced by the <rest> in --rest=<rest>.
>   * the <rest> in --rest=<rest> can also be used as the <path> for
>     %(raw:textconv) and %(raw:filters).

s/int/in/

Did you mean that %(rest) atom can also be used as <path> for the latter?
ZheNing Hu June 5, 2021, 1:19 p.m. UTC | #2
Bagas Sanjaya <bagasdotme@gmail.com> 于2021年6月5日周六 下午6:29写道:
>
> Hi,
>
> On 05/06/21 16.13, ZheNing Hu via GitGitGadget wrote:
> > In order to let git cat-file --batch reuse ref-filter logic, This patch,
> > %(rest), %(raw:textconv), %(raw:filters) atoms and --rest=<rest> option are
> > added to ref-filter.
> >
>
> Better say "Add ... atoms and --rest=<rest> option to ref-filter, in
> order to let git cat-file reuse ref-filter logic."
>

OK.

> >   * %(rest) int the format will be replaced by the <rest> in --rest=<rest>.
> >   * the <rest> in --rest=<rest> can also be used as the <path> for
> >     %(raw:textconv) and %(raw:filters).
>
> s/int/in/
>
> Did you mean that %(rest) atom can also be used as <path> for the latter?
>

No. just the <rest> in `--rest=<rest>` will be treated as <path> for
%(raw:textconv)
and %(raw:filters).

> --
> An old man doll... just what I always wanted! - Clara

Thanks.
--
ZheNing Hu
Junio C Hamano June 7, 2021, 5:55 a.m. UTC | #3
"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:

> The current series is based on 0efed9435 ([GSOC] ref-filter: add %(raw)
> atom)

I do not have that commit object, but these six patches include the
two commits that are %(raw) and %(raw:size), so I'll just discard
the old round that wasn't based on the atom-type stuff and queue
these six as a single series.

As I already said, I am not sure how %(rest) makes any sense outside
the context of "cat-file --batch"; I suspect it would make more sense
to make it easier to arrange certain placeholders to error out when
used in a context where they do not make sense (e.g. use of --rest
in "git branch --list").
ZheNing Hu June 7, 2021, 1:06 p.m. UTC | #4
Junio C Hamano <gitster@pobox.com> 于2021年6月7日周一 下午1:56写道:
>
> "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > The current series is based on 0efed9435 ([GSOC] ref-filter: add %(raw)
> > atom)
>
> I do not have that commit object, but these six patches include the
> two commits that are %(raw) and %(raw:size), so I'll just discard
> the old round that wasn't based on the atom-type stuff and queue
> these six as a single series.
>

Well, it is a commit that has not been sent to the mailing list. But it’s okay
to treat the new 6 commits as a new patch series.

> As I already said, I am not sure how %(rest) makes any sense outside
> the context of "cat-file --batch"; I suspect it would make more sense
> to make it easier to arrange certain placeholders to error out when
> used in a context where they do not make sense (e.g. use of --rest
> in "git branch --list").
>

I agree.

--
ZheNing Hu
Junio C Hamano June 8, 2021, 6:42 a.m. UTC | #5
"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:

> ZheNing Hu (6):
>   [GSOC] ref-filter: add obj-type check in grab contents
>   [GSOC] ref-filter: add %(raw) atom
>   [GSOC] ref-filter: use non-const ref_format in *_atom_parser()
>   [GSOC] ref-filter: add %(rest) atom and --rest option
>   [GSOC] ref-filter: teach grab_sub_body_contents() return value and err
>   [GSOC] ref-filter: add %(raw:textconv) and %(raw:filters)

I haven't gotten around looking at anything after the %(rest) one,
but 

https://github.com/git/git/runs/2770688471?check_suite_focus=true

seems to tell us that there is "size_t *" vs "ulong *" type
confusion, possibly around the textconv thing.
ZheNing Hu June 8, 2021, 12:52 p.m. UTC | #6
Junio C Hamano <gitster@pobox.com> 于2021年6月8日周二 下午2:42写道:
>
> "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > ZheNing Hu (6):
> >   [GSOC] ref-filter: add obj-type check in grab contents
> >   [GSOC] ref-filter: add %(raw) atom
> >   [GSOC] ref-filter: use non-const ref_format in *_atom_parser()
> >   [GSOC] ref-filter: add %(rest) atom and --rest option
> >   [GSOC] ref-filter: teach grab_sub_body_contents() return value and err
> >   [GSOC] ref-filter: add %(raw:textconv) and %(raw:filters)
>
> I haven't gotten around looking at anything after the %(rest) one,
> but
>
> https://github.com/git/git/runs/2770688471?check_suite_focus=true
>
> seems to tell us that there is "size_t *" vs "ulong *" type
> confusion, possibly around the textconv thing.
>
>

ok, I will change it when we use %(raw:textconv) next time.

Thanks.
--
ZheNing Hu