git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: Drew DeVault <sir@cmpwn.com>, git@vger.kernel.org
Subject: Re: [PATCH v2] builtin/log.c: prepend "RFC" on --rfc
Date: Mon, 28 Aug 2023 16:53:42 -0700	[thread overview]
Message-ID: <xmqqledug1vd.fsf@gitster.g> (raw)
In-Reply-To: <ZO0sFWJLX8YaJ2F/@nand.local> (Taylor Blau's message of "Mon, 28 Aug 2023 19:21:57 -0400")

Taylor Blau <me@ttaylorr.com> writes:

> I am not super familiar with this code, so could easily be missing
> something here, but I think that you can do this in a more direct way
> like so:
> ...
>  static int rfc_callback(const struct option *opt, const char *arg, int unset)
>  {
> +	free(subject_prefix);
> +	subject_prefix = xstrfmt("RFC %s", revs->subject_prefix);

As Phillip Wood pointed out, this approach no longer works once
"--rfc" is "no matter what subject-prefix says, we prepend RFC in
front", as the order of command line flags is not forced.  At this
point, revs->subject_prefix may be one value (or worse, even not
initialized), and then --subject-prefix=<new-prefix> command line
argument may yet to be parsed.

> +	return subject_prefix_callback(opt, subject_prefix, unset);
>  }

So, we'd most likely need to treat subject_prefix and rfc as two
separate strings while parse_options() is doing its work, and then
after that prepend the rfc string, if set, to the final version of
the subject_prefix string.

      reply	other threads:[~2023-08-28 23:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28 14:48 [PATCH v2] builtin/log.c: prepend "RFC" on --rfc Drew DeVault
2023-08-28 16:15 ` Junio C Hamano
2023-08-28 23:21   ` Taylor Blau
2023-08-28 23:53     ` Junio C Hamano [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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqledug1vd.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=sir@cmpwn.com \
    /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.
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 NNTP newsgroup(s).