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

Re: [PATCHv2 1/3] format-patch: create patch filename in one function

From
Stephen Boyd <bebarino@gmail.com>
Date
Mar 22, 2009, 05:59 UTC
Message-ID
<49C5D3BC.3030100@gmail.com>
In-Reply-To
<7vwsai86nw.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 11 quoted lines
> The renaming is a good idea even without any change in the feature.
> Naming functions after what their result is used _for_ is never a good
> idea, and we should name them after what they do.
>
> Does it still make sense to pass "keep_subject" to the function?  After
> all what it does is to retain "[PATCH.." prefix that is useless for the
> purpose of making each patch easily identifiable.  Because people almost
> always use patch acceptance tools in non-keep mode to strip the
> "[PATCH..]"  prefix when creating the commits these days anyway, it may
> make more sense to lose the parameter altogether and simplify the
> processing.

I originally removed "keep_subject" but I took it out because I couldn't figure out what it was being used for and I thought it might be important. When it's removed all the tests pass. It's not even used by other code besides a few if cases regarding numbering logic so I think the entire command line switch could be removed.

Show 9 quoted lines
>
> I also wonder if it makes sense to move what this function does into a
> user format; especially the logic that sanitizes the oneline string into
> filename friendly one may be something Porcelains may want an access to
> from outside.
>
> IOW, you can introduce a new format specifier (say, "%f") to
> format_commit_message() and the implemention of get_patch_filename() would
> just prepare a strbuf and call format_commit_message() on it, no?

This sounds great! I'm new so I don't know where to look for something like this.

Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 20 in “[PATCHv2 0/3] format-patch --attach/--inline use filename instead of SHA1”
  1. Stephen BoydMar 22, 2009
  2. 1/3 format-patch: create patch filename in one functionStephen Boyd, Mar 22, 2009
  3. 2/3 format-patch: --attach/inline uses filename instead of SHA1Stephen Boyd, Mar 22, 2009
  4. 3/3 format-patch: --numbered-files and --stdout aren't mutually exclusiveStephen Boyd, Mar 22, 2009
  5. Junio C HamanoMar 22, 2009
  6. Junio C HamanoMar 22, 2009
  7. Junio C HamanoMar 22, 2009
  8. Stephen BoydMar 22, 2009
  9. Junio C HamanoMar 22, 2009
  10. Stephen BoydMar 22, 2009
  11. Junio C HamanoMar 22, 2009
  12. 0/6 format-patch --attach/--inline uses filename not SHA1Stephen Boyd, Mar 23, 2009
  13. 1/6 pretty.c: add %f format specifier to format_commit_message()Stephen Boyd, Mar 23, 2009
  14. 2/6 format-patch: construct patch filename in one functionStephen Boyd, Mar 23, 2009
  15. 3/6 format-patch: pass a commit to reopen_stdout()Stephen Boyd, Mar 23, 2009
  16. 4/6 format-patch: move get_patch_filename() into log-treeStephen Boyd, Mar 23, 2009
  17. 5/6 format-patch: --attach/inline uses filename instead of SHA1Stephen Boyd, Mar 23, 2009
  18. 6/6 format-patch: --numbered-files and --stdout aren't mutually exclusiveStephen Boyd, Mar 23, 2009
  19. René ScharfeMar 31, 2009
  20. format_sanitized_subject: Don't trim past initial length of strbufStephen Boyd, Mar 31, 2009

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.