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

Re: [PATCH 3/3] format-patch: --no-clobber refrains from overwriting output files

From
Jeff King <peff@peff.net>
Date
Feb 23, 2019, 13:34 UTC
Message-ID
<20190223133418.GD22403@sigill.intra.peff.net>
In-Reply-To
<20190222201111.98196-4-gitster@pobox.com>
On Fri, Feb 22, 2019 at 12:11:11PM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> If you keep an output for an older iteration of the same topic in
> the same directory around and use "git format-patch" to prepare a
> newer iteration of the topic, those commits that happen to be at the
> same position in the series that have not been retitled will get the
> same filename---and the command opens them for writing without any
> check.
> 
> Existing "-o outdir" and "-v number" options are both good ways to
> avoid such name collisions, and in general helps to give good ways
> to compare the latest iteration with older iteration(s), but let's
> see if "--no-clobber" option that forbids overwrting existing files
> would also help people.

I suspect it won't help much, because remembering to use --no-clobber is just as hard as remembering to clean up the stale patches in the first place.

If we were starting from scratch, I'd suggest that --no-clobber be the default[1]. But at this point I wonder if people would be annoyed (because the clobbering behavior is convenient and works _most_ of the time, as long as you don't add, remove, reorder, or retitle patches).

I suppose that implies having a config option, so at least people who want it only have to remember once.

>  Documentation/git-format-patch.txt |  8 +++++++-
>  builtin/log.c                      | 32 ++++++++++++++++++++++++------
>  t/t4014-format-patch.sh            | 16 +++++++++++++++
>  3 files changed, 49 insertions(+), 7 deletions(-)
The patch itself looks well done.
-Peff
[1] Actually, I'd suggest that --stdout be the default, which is what I
    always use. But then I typically feed the result into mutt anyway.
    Separate files is probably nicer if you're hand-editing.
Previous: Eric SunshineNext: Ntentos Stavros
Message 8 of 9 in “format-patch --no-clobber”
  1. 0/3 format-patch --no-clobberJunio C Hamano, Feb 22, 2019
  2. 1/3 builtin/log: downcase the beginning of error messagesJunio C Hamano, Feb 22, 2019
  3. Eric SunshineFeb 22, 2019
  4. Junio C HamanoFeb 22, 2019
  5. 2/3 format-patch: notice failure to open cover letter for writingJunio C Hamano, Feb 22, 2019
  6. 3/3 format-patch: --no-clobber refrains from overwriting output filesJunio C Hamano, Feb 22, 2019
  7. Eric SunshineFeb 22, 2019
  8. Jeff KingFeb 23, 2019
  9. Ntentos StavrosMar 12, 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.