Re: [PATCH 4/6] [GSOC] ref-filter: add %(rest) atom and --rest option
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 8, 2021, 06:50 UTC
- Message-ID
- <xmqqo8cgq28e.fsf@gitster.g>
- In-Reply-To
- <CAOLTT8S+5m+-XF-AcQi9t8njTvyDYzHt=BU+4OPcvTT27RP6dw@mail.gmail.com>
ZheNing Hu <adlternative@gmail.com> writes:
> First of all, although %(rest) is meaningless in ordinary circumstances, > ref-filter must learn %(rest), it is impossible for us to leave the parsing > of %(rest) in cat-file.c alone.
Oh, there is no question about that.
> Then, `--rest` is a strategy that make %(rest) can use in `git for-each-ref` > or `git branch -l`.
If there is no need to expose %(rest) to the users who write --format for these two commands, it would be much better to detect attempted use of %(rest) and error out.
> This sounds like it might help `cat-file` to reject some useless atoms > like %(refname).
Yes.
Show 6 quoted lines
> So something like: > > $ git for-each-ref --format="%(objectname) %(objectsize)" > --refject-atoms="%(objectsize) %(objectname)" > > will fail.
I don't understand. Why do you even need to add --reject? Why would any user would want to use it with for-each-ref?
Without any end-user input, %(rest) for for-each-ref would not make sense, and %(refname) for cat-file --batch would not make sense, I would imagine, so there is no need to be able to tell --reject=rest to for-each-ref. It is not like giving --no-reject=rest to for-each-ref and make it interpolate to an empty string is a useful feature anyway, so I do not see a need for such an option.