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

Re: git format-patch can clobber existing patch

From
ΣΝΣταύρος Ντέντος <stdedos@gmail.com>
Date
Feb 23, 2019, 09:53 UTC
Message-ID
<CAHMHMxXxo4zXcriBJE2k3mWgwAj7KGA_AChuEmyciESGOC_7Bg@mail.gmail.com>
In-Reply-To
<xmqqva1bpq9d.fsf@gitster-ct.c.googlers.com>

Ντέντος Σταύρος On Fri, Feb 22, 2019 at 9:38 PM Junio C Hamano <gitster@pobox.com> wrote:

Show 17 quoted lines
>
> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
> > On Thu, Feb 21, 2019 at 03:40:09PM -0800, Junio C Hamano wrote:
> >> Σταύρος Ντέντος  <stdedos@gmail.com> writes:
> >> > Would it make sense / be easy enough to have some clobbering check / flag?
> >>
> >> Given that use of '-o' to redirect to a fresh/new directory would
> >> reduce the risk of such clobbering, and use of '-v' to force
> >> different filenames would reduce the risk of such clobbering,
> >> it seems to me that aborting the operation when we fail to open
> >> the output, without any option to override and allow clobbering,
> >> would make sense.  If existing files record 4 patch series
> >> 0001-x.patch, 0002-y.patch, 0003-z.patch, and 0004-w.patch, and you
> >> generate with "format-patch --allow-clobbering" a three-patch series,
> >> it would overwrite 0001 thru 0003 but will not remove 0004, so the
> >> end result will still be confusing.

There might be a handful of complexities / undefined behaviors coming out of this; however, I think "not" overwriting a file to be a higher directive (given that then, it is unrecoverable). Using any of the '-o', '-v' might be helpful - if you are re-running commands from history, however, it wouldn't necessarily provide any protection ;-)

Show 6 quoted lines
> > I think a flag for this would be useful. For people that store tarballs
> > (or pristine-tar files) and patches in their repository, overwriting the
> > existing files is definitely desired.
> >
> > My personal preference is that the flag be --no-clobber, but I can see
> > arguments for the other side as well.

On my head, I was thinging that preferably `git config format-patch.no-clobber true` could be set, instead of (continuously) carrying around a `--no-clobber` flag. I should've probably be more clear about that. However, any way is "as good as any".

Show 16 quoted lines
> That's actually simpler, which is good, as we do not have to worry
> about adjusting the existing tests that rely on the clobbering
> behaviour ;-).
>
> I'll find time before I leave for my offline week, but this
> obviously will not be merged before the upcoming release.
>
> Thanks.  I think I've mostly outlined a three-patch series to do
> this ready.
>
>
>
>
>
>
>
Previous: Junio C Hamano
Message 5 of 5 in “Re: git format-patch can clobber existing patch”
  1. Σταύρος ΝτέντοςFeb 21, 2019
  2. Junio C HamanoFeb 21, 2019
  3. brian m. carlsonFeb 22, 2019
  4. Junio C HamanoFeb 22, 2019
  5. Σταύρος ΝτέντοςFeb 23, 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.