git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git format-patch --break-rewrites broken in 2.9.3
@ 2016-08-18 14:44 Olaf Hering
  2016-08-18 15:05 ` Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Olaf Hering @ 2016-08-18 14:44 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 377 bytes --]

This command used to create a diff which can be consumed by patch. But
at least with 2.9.3 it just gives a rename output:

 git format-patch \
        --no-signature \
        --stdout \
        --break-rewrites \
        --keep-subject \
 95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d


What must be done now to get a usable patch?

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 14:44 git format-patch --break-rewrites broken in 2.9.3 Olaf Hering
@ 2016-08-18 15:05 ` Jeff King
  2016-08-18 15:15   ` Jeff King
       [not found]   ` <vpqa8gayumw.fsf@anie.imag.fr>
  2016-08-18 15:15 ` Johannes Schindelin
  2016-08-19 18:04 ` Philip Oakley
  2 siblings, 2 replies; 11+ messages in thread
From: Jeff King @ 2016-08-18 15:05 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Matthieu Moy, git

On Thu, Aug 18, 2016 at 04:44:21PM +0200, Olaf Hering wrote:

> This command used to create a diff which can be consumed by patch. But
> at least with 2.9.3 it just gives a rename output:
> 
>  git format-patch \
>         --no-signature \
>         --stdout \
>         --break-rewrites \
>         --keep-subject \
>  95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
> 
> 
> What must be done now to get a usable patch?

Probably --no-renames.

Renames were enabled by default by 5404c11 (diff: activate diff.renames
by default, 2016-02-25), which is in v2.9.0.

I wonder if we should consider undoing that for format-patch, whose
output may be consumed by non-git endpoints.

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 14:44 git format-patch --break-rewrites broken in 2.9.3 Olaf Hering
  2016-08-18 15:05 ` Jeff King
@ 2016-08-18 15:15 ` Johannes Schindelin
  2016-08-18 17:27   ` Junio C Hamano
  2016-08-19 18:04 ` Philip Oakley
  2 siblings, 1 reply; 11+ messages in thread
From: Johannes Schindelin @ 2016-08-18 15:15 UTC (permalink / raw)
  To: Olaf Hering; +Cc: git

Hi Olaf,

On Thu, 18 Aug 2016, Olaf Hering wrote:

> This command used to create a diff which can be consumed by patch. But
> at least with 2.9.3 it just gives a rename output:
> 
>  git format-patch \
>         --no-signature \
>         --stdout \
>         --break-rewrites \
>         --keep-subject \
>  95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
> 
> 
> What must be done now to get a usable patch?

Maybe --no-renames? BTW this behavior was not introduced in 2.9.3, but in
2.9.0:

https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt#L7-L9

Ciao,
Johannes

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 15:05 ` Jeff King
@ 2016-08-18 15:15   ` Jeff King
       [not found]   ` <vpqa8gayumw.fsf@anie.imag.fr>
  1 sibling, 0 replies; 11+ messages in thread
From: Jeff King @ 2016-08-18 15:15 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Matthieu Moy, git

On Thu, Aug 18, 2016 at 11:05:22AM -0400, Jeff King wrote:

> On Thu, Aug 18, 2016 at 04:44:21PM +0200, Olaf Hering wrote:
> 
> > This command used to create a diff which can be consumed by patch. But
> > at least with 2.9.3 it just gives a rename output:
> > 
> >  git format-patch \
> >         --no-signature \
> >         --stdout \
> >         --break-rewrites \
> >         --keep-subject \
> >  95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
> > 
> > 
> > What must be done now to get a usable patch?
> 
> Probably --no-renames.
> 
> Renames were enabled by default by 5404c11 (diff: activate diff.renames
> by default, 2016-02-25), which is in v2.9.0.
> 
> I wonder if we should consider undoing that for format-patch, whose
> output may be consumed by non-git endpoints.

By the way, this probably has nothing to do with --break-rewrites in
particular. It would come up for any case where git finds a rename. In
the absence of --break-rewrites, that requires a path being deleted and
one being added. But in this particular case, --break-rewrites turns a
large change into a delete/add pair, which lets git find the rename.

So it's a necessary option to show the problem in _this_ instance, but
there are other cases that would not need it.

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
       [not found]   ` <vpqa8gayumw.fsf@anie.imag.fr>
@ 2016-08-18 15:40     ` Jeff King
  2016-08-18 15:48       ` Olaf Hering
  0 siblings, 1 reply; 11+ messages in thread
From: Jeff King @ 2016-08-18 15:40 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Olaf Hering, git

On Thu, Aug 18, 2016 at 05:16:55PM +0200, Matthieu Moy wrote:

> Jeff King <peff@peff.net> writes:
> 
> > On Thu, Aug 18, 2016 at 04:44:21PM +0200, Olaf Hering wrote:
> >
> >> This command used to create a diff which can be consumed by patch. But
> >> at least with 2.9.3 it just gives a rename output:
> >> 
> >>  git format-patch \
> >>         --no-signature \
> >>         --stdout \
> >>         --break-rewrites \
> >>         --keep-subject \
> >>  95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
> >> 
> >> 
> >> What must be done now to get a usable patch?
> >
> > Probably --no-renames.
> >
> > Renames were enabled by default by 5404c11 (diff: activate diff.renames
> > by default, 2016-02-25), which is in v2.9.0.
> >
> > I wonder if we should consider undoing that for format-patch, whose
> > output may be consumed by non-git endpoints.
> 
> I would say no (or more precisely: we should consider, but we should
> reject the idea ;-) ), since patches with renames are useful and can be used
> even outside Git's scope. GNU patch, which is probably the most widely
> used implementation of patch supports git-style renames since 2.7,
> released in September 2012.

Ah, OK; I didn't realize GNU patch had picked up rename support. I agree
that makes it less-bad for format-patch to start using them by default.
Olaf, what version of patch are you using?

-Peff

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 15:40     ` Jeff King
@ 2016-08-18 15:48       ` Olaf Hering
  2016-08-18 16:16         ` Matthieu Moy
  0 siblings, 1 reply; 11+ messages in thread
From: Olaf Hering @ 2016-08-18 15:48 UTC (permalink / raw)
  To: Jeff King; +Cc: Matthieu Moy, git

[-- Attachment #1: Type: text/plain, Size: 258 bytes --]

On Thu, Aug 18, Jeff King wrote:

> Olaf, what version of patch are you using?

Mostly 2.7.x, but also add 2.5.x to the mix.
So far I did not try what the tools dealing with the resulting patch
file would actually do with such a stripped down variant.

Olaf

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 15:48       ` Olaf Hering
@ 2016-08-18 16:16         ` Matthieu Moy
  0 siblings, 0 replies; 11+ messages in thread
From: Matthieu Moy @ 2016-08-18 16:16 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Jeff King, git

Olaf Hering <olaf@aepfle.de> writes:

> On Thu, Aug 18, Jeff King wrote:
>
>> Olaf, what version of patch are you using?
>
> Mostly 2.7.x, but also add 2.5.x to the mix.
> So far I did not try what the tools dealing with the resulting patch
> file would actually do with such a stripped down variant.

I think the way to go is --no-renames until you stop using patch <2.7.
If you don't want to specify it each time, you can revert to the pre-2.9
behavior by setting

[diff]
	renames = false

in ~/.gitconfig.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 15:15 ` Johannes Schindelin
@ 2016-08-18 17:27   ` Junio C Hamano
  2016-08-18 20:42     ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2016-08-18 17:27 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Olaf Hering, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Olaf,
>
>>         --break-rewrites \
>>         --keep-subject \
>>  95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
>> 
>> What must be done now to get a usable patch?
>
> Maybe --no-renames? BTW this behavior was not introduced in 2.9.3, but in
> 2.9.0:
>
> https://github.com/git/git/blob/v2.9.0/Documentation/RelNotes/2.9.0.txt#L7-L9

I think that is one half of the story.

The other half is a long/well known bug that lets "diff -B -M" to
produce incorrect/broken patch that cannot be applied.  It was
documented in the thread that begins at:

    public-inbox.org/git/xmqqfvapuhkk.fsf@gitster.dls.corp.google.com

but still hasn't been solved.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 17:27   ` Junio C Hamano
@ 2016-08-18 20:42     ` Junio C Hamano
  0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2016-08-18 20:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Olaf Hering, git

Junio C Hamano <gitster@pobox.com> writes:

> I think that is one half of the story.
>
> The other half is a long/well known bug that lets "diff -B -M" to
> produce incorrect/broken patch that cannot be applied.  It was
> documented in the thread that begins at:
>
>     public-inbox.org/git/xmqqfvapuhkk.fsf@gitster.dls.corp.google.com
>
> but still hasn't been solved.

The problem report actually starts here:

    public-inbox.org/git/xmqqegqaahnh.fsf@gitster.dls.corp.google.com/


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-18 14:44 git format-patch --break-rewrites broken in 2.9.3 Olaf Hering
  2016-08-18 15:05 ` Jeff King
  2016-08-18 15:15 ` Johannes Schindelin
@ 2016-08-19 18:04 ` Philip Oakley
  2016-08-19 18:41   ` Andreas Schwab
  2 siblings, 1 reply; 11+ messages in thread
From: Philip Oakley @ 2016-08-19 18:04 UTC (permalink / raw)
  To: Olaf Hering, git

On Thu, Aug 18, 2016 at 04:44:21PM +0200, Olaf Hering wrote:

> This command used to create a diff which can be consumed by patch. But
> at least with 2.9.3 it just gives a rename output:
>
>  git format-patch \
>         --no-signature \
>         --stdout \
>         --break-rewrites \
>         --keep-subject \
> 
> 95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
>
>
> What must be done now to get a usable patch?

As an aside, the range can be shortened to

95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^!

It's something I picked up when doing the doc update on 'specifying 
revisions'.

--

Philip


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: git format-patch --break-rewrites broken in 2.9.3
  2016-08-19 18:04 ` Philip Oakley
@ 2016-08-19 18:41   ` Andreas Schwab
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2016-08-19 18:41 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Olaf Hering, git

On Aug 19 2016, "Philip Oakley" <philipoakley@iee.org> wrote:

> On Thu, Aug 18, 2016 at 04:44:21PM +0200, Olaf Hering wrote:
>
>> This command used to create a diff which can be consumed by patch. But
>> at least with 2.9.3 it just gives a rename output:
>>
>>  git format-patch \
>>         --no-signature \
>>         --stdout \
>>         --break-rewrites \
>>         --keep-subject \
>>
>> 95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^..95fa0405c5991726e06c08ffcd8ff872f7fb4f2d
>>
>>
>> What must be done now to get a usable patch?
>
> As an aside, the range can be shortened to
>
> 95fa0405c5991726e06c08ffcd8ff872f7fb4f2d^!

In the context of format-patch you can also use -1 to select the topmost
commit from the list.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-08-19 18:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-18 14:44 git format-patch --break-rewrites broken in 2.9.3 Olaf Hering
2016-08-18 15:05 ` Jeff King
2016-08-18 15:15   ` Jeff King
     [not found]   ` <vpqa8gayumw.fsf@anie.imag.fr>
2016-08-18 15:40     ` Jeff King
2016-08-18 15:48       ` Olaf Hering
2016-08-18 16:16         ` Matthieu Moy
2016-08-18 15:15 ` Johannes Schindelin
2016-08-18 17:27   ` Junio C Hamano
2016-08-18 20:42     ` Junio C Hamano
2016-08-19 18:04 ` Philip Oakley
2016-08-19 18:41   ` Andreas Schwab

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