git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] builtin/log.c: prepend "RFC" on --rfc

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 28, 2023, 23:53 UTC
Message-ID
<xmqqledug1vd.fsf@gitster.g>
In-Reply-To
<ZO0sFWJLX8YaJ2F/@nand.local>
Taylor Blau <me@ttaylorr.com> writes:
Show 8 quoted lines
> 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.

Previous: Taylor Blau
Message 4 of 4 in “builtin/log.c: prepend "RFC" on --rfc”
  1. builtin/log.c: prepend "RFC" on --rfcDrew DeVault, Aug 28, 2023
  2. Junio C HamanoAug 28, 2023
  3. Taylor BlauAug 28, 2023
  4. Junio C HamanoAug 28, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.