Re: git apply vs patch -p1

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Josh Berkus <josh(at)agliodbs(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: git apply vs patch -p1
Date: 2013-09-16 10:23:38
Message-ID: 20130916102338.GL1330627@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-09-16 10:16:37 +0530, Ashutosh Bapat wrote:
> On Sun, Sep 15, 2013 at 12:38 AM, Andres Freund <andres(at)2ndquadrant(dot)com>wrote:
>
> > On 2013-09-14 15:03:52 -0400, Andrew Dunstan wrote:
> > >
> > > On 09/14/2013 02:37 PM, Josh Berkus wrote:
> > > >Folks,
> > > >
> > > >Lately I've been running into a lot of reports of false conflicts
> > > >reported by "git apply". The most recent one was the "points" patch,
> > > >which git apply rejected for completely ficticious reasons (it claimed
> > > >that the patch was trying to create a new file where a file already
> > > >existed, which it wasn't).
> > > >
> > > >I think we should modify the patch review and developer instructions to
> > > >recommend always using patch -p1 (or -p0, depending), even if the patch
> > > >was produced with "git diff".
> > > >
> > > >Thoughts?
> > > >
> > >
> > >
> > > FWIW that's what I invariably use.
> > >
> > > You do have to be careful to git-add/git-rm any added/deleted files,
> > which
> > > git-apply does for you (as well as renames) - I've been caught by that a
> > > couple of times.
> >
> > git reset?
> >
> >
> git reset wouldn't remove the files that were newly added by the patch,
> would it?

Depends on how you do it. I simply commit patches I look at - then they
can easily be removed using git reset --hard HEAD^. And it allows to
make further changes/annotations during review that are clearly
separated from the patch.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-09-16 10:25:10 Re: Minmax indexes
Previous Message Chris Travers 2013-09-16 10:19:19 Re: Minmax indexes