mbox series

[v4,0/3] apply with core.filemode=false

Message ID 20231226233218.472054-1-gitster@pobox.com (mailing list archive)
Headers show
Series apply with core.filemode=false | expand

Message

Junio C Hamano Dec. 26, 2023, 11:32 p.m. UTC
Chandra Pratap noticed that "git apply" on a filesystem without
executable bit support gives a warning when applying a patch that
expects the preimage file to have executable bit on.  Dscho noticed
that the initial fix by Chandra did not work well when applying a
patch in reverse.  It turns out that apply.c:reverse_patches()
invalidates the "a patch that does not change mode bits have the
mode bits in .old_mode member and not in .new_mode member" invariant
we rely on.

Here is the result of concerted effort.

Chandra Pratap (1):
  apply: ignore working tree filemode when !core.filemode

Junio C Hamano (2):
  apply: correctly reverse patch's pre- and post-image mode bits
  apply: code simplification

 apply.c                   | 16 +++++++++++++---
 t/t4129-apply-samemode.sh | 27 +++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

Comments

Junio C Hamano Feb. 7, 2024, 10:15 p.m. UTC | #1
Junio C Hamano <gitster@pobox.com> writes:

> Chandra Pratap noticed that "git apply" on a filesystem without
> executable bit support gives a warning when applying a patch that
> expects the preimage file to have executable bit on.  Dscho noticed
> that the initial fix by Chandra did not work well when applying a
> patch in reverse.  It turns out that apply.c:reverse_patches()
> invalidates the "a patch that does not change mode bits have the
> mode bits in .old_mode member and not in .new_mode member" invariant
> we rely on.
>
> Here is the result of concerted effort.
>
> Chandra Pratap (1):
>   apply: ignore working tree filemode when !core.filemode
>
> Junio C Hamano (2):
>   apply: correctly reverse patch's pre- and post-image mode bits
>   apply: code simplification
>
>  apply.c                   | 16 +++++++++++++---
>  t/t4129-apply-samemode.sh | 27 +++++++++++++++++++++++++++
>  2 files changed, 40 insertions(+), 3 deletions(-)

Anybody wants to offer a review on this?  I actually am fairly
confortable with these without any additional review, but since I am
sweeping the "Needs review" topics in the What's cooking report, I
thought I would ask for this one, too.
Johannes Schindelin Feb. 18, 2024, 10:38 p.m. UTC | #2
Hi Junio,

On Wed, 7 Feb 2024, Junio C Hamano wrote:

> Junio C Hamano <gitster@pobox.com> writes:
>
> > Chandra Pratap noticed that "git apply" on a filesystem without
> > executable bit support gives a warning when applying a patch that
> > expects the preimage file to have executable bit on.  Dscho noticed
> > that the initial fix by Chandra did not work well when applying a
> > patch in reverse.  It turns out that apply.c:reverse_patches()
> > invalidates the "a patch that does not change mode bits have the
> > mode bits in .old_mode member and not in .new_mode member" invariant
> > we rely on.
> >
> > Here is the result of concerted effort.
> >
> > Chandra Pratap (1):
> >   apply: ignore working tree filemode when !core.filemode
> >
> > Junio C Hamano (2):
> >   apply: correctly reverse patch's pre- and post-image mode bits
> >   apply: code simplification
> >
> >  apply.c                   | 16 +++++++++++++---
> >  t/t4129-apply-samemode.sh | 27 +++++++++++++++++++++++++++
> >  2 files changed, 40 insertions(+), 3 deletions(-)
>
> Anybody wants to offer a review on this?  I actually am fairly
> confortable with these without any additional review, but since I am
> sweeping the "Needs review" topics in the What's cooking report, I
> thought I would ask for this one, too.

I just had a look over all three of the patches, and to me, they look good
to go.

Ciao,
Johannes
Junio C Hamano Feb. 19, 2024, 9:24 p.m. UTC | #3
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> > Chandra Pratap (1):
>> >   apply: ignore working tree filemode when !core.filemode
>> >
>> > Junio C Hamano (2):
>> >   apply: correctly reverse patch's pre- and post-image mode bits
>> >   apply: code simplification
>> >
>> >  apply.c                   | 16 +++++++++++++---
>> >  t/t4129-apply-samemode.sh | 27 +++++++++++++++++++++++++++
>> >  2 files changed, 40 insertions(+), 3 deletions(-)
>>
>> Anybody wants to offer a review on this?  I actually am fairly
>> confortable with these without any additional review, but since I am
>> sweeping the "Needs review" topics in the What's cooking report, I
>> thought I would ask for this one, too.
>
> I just had a look over all three of the patches, and to me, they look good
> to go.

Thanks.