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

Re: [PATCH v2 2/2] format-patch: add format.cover-letter configuration

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 7, 2013, 03:32 UTC
Message-ID
<7vk3of817v.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1365239012-15079-3-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
> Also, add a new option: 'auto', so if there's more than one patch, the
> cover letter is generated, otherwise it's not.
Very sensible goal.
> This has the slight disadvantage that a piece of code will always be run
> even if the user doesn't want a cover letter, and thus waste a few
> cycles.
I am not sure what overhead you are referring to.

We need to count how many we are emitting with or without the cover letter, and count is stored in "total". Even when the user said "auto" (which I personally think should become the default in the longer term, but that is a separate issue), we shouldn't have to spend any extra cost if you moved the code that does anything heavy for cover letter generation after we know what that "total" is, no?

I think the reason you did not move the "find the branch for use in the cover letter" code down was because it uses the rev->pending interface, which you cannot read out of after you count the commits, but that logic to use rev->pending predates the introduction of a more modern rev->cmdline mechanism, which is already used by the find_branch_name() function in the same codepath, and it is not clobbered by prepare_revision_walk().

So perhaps by moving that code down after we know what value "total" has, and rewriting "what was the positive commit the user gave us" logic using rev->cmdline, you do not have to do unnecessary work at all.

Previous: Matthieu MoyNext: Felipe Contreras
Message 10 of 12 in “send-email: couple of improvements”
  1. 0/2 send-email: couple of improvementsFelipe Contreras, Apr 6, 2013
  2. 1/2 send-email: make annotate configurableFelipe Contreras, Apr 6, 2013
  3. Junio C HamanoApr 7, 2013
  4. Felipe ContrerasApr 7, 2013
  5. 2/2 format-patch: add format.cover-letter configurationFelipe Contreras, Apr 6, 2013
  6. Ramkumar RamachandraApr 6, 2013
  7. Felipe ContrerasApr 6, 2013
  8. Matthieu MoyApr 6, 2013
  9. Matthieu MoyApr 6, 2013
  10. Junio C HamanoApr 7, 2013
  11. Felipe ContrerasApr 7, 2013
  12. Matthieu MoyApr 6, 2013

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.