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

Re: [RFC WIP PATCH 2/3] tag: factor out prepare tag template code

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 10, 2019, 02:51 UTC
Message-ID
<xmqqo8ypjota.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191008184727.14337-3-lucasseikioshiro@gmail.com>
Lucas Oshiro <lucasseikioshiro@gmail.com> writes:
> Improve code readability by moving tag body reading to a new function called
> get_tag_body.

Quite honestly, I think the result of this splitting is harder to follow than the original.

For example, the value of opt->message_given and the validity of given_msg is very closely related, so if you made the helper function receive non-NULL given_msg when !opt->message_given, the helper could only check !given_msg without having to worry about opt->message_given; with such a change, I could buy that the split improves code readability, but I do not see any such change in the patch.

> Enhance legibility by encapsulating code that loads previous tag message
> (if any) in new function prepare_tag_template....

The helper seems to be used to _write_ into path, and not load or read any message from either an object or a file on disk.

Previous: Matheus Tavares BernardinoNext: Junio C Hamano
Message 7 of 12 in “tag: fix --edit and --no-edit flags”
  1. 0/3 tag: fix --edit and --no-edit flagsLucas Oshiro, Oct 8, 2019
  2. 1/3 tag: factor out tag reading from write_tag_body()Lucas Oshiro, Oct 8, 2019
  3. Matheus Tavares BernardinoOct 9, 2019
  4. Junio C HamanoOct 10, 2019
  5. 2/3 tag: factor out prepare tag template codeLucas Oshiro, Oct 8, 2019
  6. Matheus Tavares BernardinoOct 9, 2019
  7. Junio C HamanoOct 10, 2019
  8. Junio C HamanoOct 10, 2019
  9. 3/3 tag: add full support for --edit and --no-editLucas Oshiro, Oct 8, 2019
  10. Matheus Tavares BernardinoOct 9, 2019
  11. Junio C HamanoOct 10, 2019
  12. Junio C HamanoOct 10, 2019

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.