git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: ZheNing Hu <adlternative@gmail.com>
To: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Hariom verma <hariom18599@gmail.com>,
	Christian Couder <christian.couder@gmail.com>
Subject: [QUESTION] ref-filter: how to support atom like %an
Date: Sat, 15 May 2021 22:52:49 +0800	[thread overview]
Message-ID: <CAOLTT8QBOgcz+Q_ODnbGq5r5CzrSdX+=DMT0pJS6iPTcP0VRjA@mail.gmail.com> (raw)

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 },

Then we need to do some work on atoms parsing:
In the original design of `parse_ref_filter_atom()`, it relied on
searching for `%(` and `)` to find an atom. Now we have to
change the way of finding atoms: Currently I just replace
`find_next()` to find a single `%`. If there is `(` after `%`,
we can keep the original long name atoms parsing method,
otherwise we are dealing with the short name atom,
we need to pass the interval between the current `%`
and the next single `%` to `parse_ref_filter_atom()`.
Then we are in `parse_ref_filter_atom()`, we need to
consider these situations:

1. %(authoremail:trim)
2. %(authoremail)
3. %ae
4. %ae:trim
5. %aeabc:trim
6. %ae:trimabcd...

As we can see, the situation is starting to get complicated.
The more critical point is as in case 6: We cannot determine
the end of a short name atom because it does not have an
explicit `)` end.
In this way, many of the `*_atom_parser` functions in
`ref-filter.c` will not work, because most of them use `strcmp()`
to check the attribute of an atom. If we want to support the
short name `%ae`, that would require a large-scale rewrite.

Any good ideas, friends?

--
ZheNing Hu

             reply	other threads:[~2021-05-15 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 14:52 ZheNing Hu [this message]
2021-05-16  3:55 ` [QUESTION] ref-filter: how to support atom like %an Junio C Hamano
2021-05-17  2:13   ` ZheNing Hu

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='CAOLTT8QBOgcz+Q_ODnbGq5r5CzrSdX+=DMT0pJS6iPTcP0VRjA@mail.gmail.com' \
    --to=adlternative@gmail.com \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hariom18599@gmail.com \
    --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).