Re: [QUESTION] ref-filter: how to support atom like %an

2 messages, 2 authors, 2021-05-17 · open the first message on its own page

Re: [QUESTION] ref-filter: how to support atom like %an

From: Junio C Hamano <hidden>
Date: 2021-05-16 03:55:28

ZheNing Hu [off-list ref] writes:
My current thinking is this:

First add a new member `short_name` in `struct valid_atom`,
Then we can share a valid_atom item for the long name of
an atom such as `%(authoremail)` and the short name of
the atom `%ae` (%aE is not considered at the time).
Something like:

[ATOM_AUTHOREMAIL] = { "ae", "authoremail", SOURCE_OBJ, FIELD_STR,
person_email_atom_parser },
My assumption has always been that when enriching "--format" of the
"log" family (e.g. "status", "show") with ingredients from the
"for-each-ref" family (e.g. "branch", "tag"), we would adopt the
notation the latter uses, i.e. "git log --format='%s %(notes)'",
with the full intention that eventually users would choose between
the synonyms to make it "git log --format='%(subject) %(notes)'" for
consistency, without wasting brain cycles to come up with and to
remember two-letter shorthands that will not scale.

Re: [QUESTION] ref-filter: how to support atom like %an

From: ZheNing Hu <hidden>
Date: 2021-05-17 02:13:42

Junio C Hamano [off-list ref] 于2021年5月16日周日 上午11:55写道:
ZheNing Hu [off-list ref] writes:
quoted
My current thinking is this:

First add a new member `short_name` in `struct valid_atom`,
Then we can share a valid_atom item for the long name of
an atom such as `%(authoremail)` and the short name of
the atom `%ae` (%aE is not considered at the time).
Something like:

[ATOM_AUTHOREMAIL] = { "ae", "authoremail", SOURCE_OBJ, FIELD_STR,
person_email_atom_parser },
My assumption has always been that when enriching "--format" of the
"log" family (e.g. "status", "show") with ingredients from the
"for-each-ref" family (e.g. "branch", "tag"), we would adopt the
notation the latter uses, i.e. "git log --format='%s %(notes)'",
with the full intention that eventually users would choose between
the synonyms to make it "git log --format='%(subject) %(notes)'" for
consistency, without wasting brain cycles to come up with and to
remember two-letter shorthands that will not scale.
Well, it’s truly more useful to provide long name atoms for the "log" family,
But if we need to establish a unified interface for --format, shouldn't
we extend it base on `ref-filter`?

At present, the scalability of the implementation in `ref-filter` is better,
but it does not support two-letter shorthands atoms...

--
ZheNing Hu
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help