git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 3/3] format-patch: --no-clobber refrains from overwriting output files
Date: Sat, 23 Feb 2019 08:34:19 -0500	[thread overview]
Message-ID: <20190223133418.GD22403@sigill.intra.peff.net> (raw)
In-Reply-To: <20190222201111.98196-4-gitster@pobox.com>

On Fri, Feb 22, 2019 at 12:11:11PM -0800, Junio C Hamano wrote:

> 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.

  parent reply	other threads:[~2019-02-23 13:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-22 20:11 [PATCH 0/3] format-patch --no-clobber Junio C Hamano
2019-02-22 20:11 ` [PATCH 1/3] builtin/log: downcase the beginning of error messages Junio C Hamano
2019-02-22 20:24   ` Eric Sunshine
2019-02-22 20:40     ` Junio C Hamano
2019-02-22 20:11 ` [PATCH 2/3] format-patch: notice failure to open cover letter for writing Junio C Hamano
2019-02-22 20:11 ` [PATCH 3/3] format-patch: --no-clobber refrains from overwriting output files Junio C Hamano
2019-02-22 20:38   ` Eric Sunshine
2019-02-23 13:34   ` Jeff King [this message]
2019-03-12 20:53     ` Ntentos Stavros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190223133418.GD22403@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).