"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: two small fixes for got patch
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 11 Mar 2022 20:01:07 +0100

Download raw body.

Thread
On Fri, Mar 11, 2022 at 07:45:21PM +0100, Omar Polo wrote:
> Omar Polo <op@omarpolo.com> wrote:
> > thanks thomas and stsp for reviewing!
> > 
> > I had another small tweak i'd like to commit before moving into more
> > interesting diffs (dry run, error recovering, no final newline etc) that
> > I forgot to include in previous mail, apologies.
> > 
> > The following moves some checks done in apply_patch early in recv_patch
> > so that we bail out early in case of malformed patches and changes the
> > error for mismatching paths from
> > 
> > 	% got patch < diff
> > 	got: the paths mentioned in the patch are different.
> > to
> > 	% got patch < diff
> > 	got: old file is "foo" and new "bar": paths are different
> > 
> > OK?
> 
> apologies for the non-applying diff.  it was meant to be applied on top
> of the "check file status before applying a patch" diff I sent a few
> days ago (and that's still pending ;-).  Anyway, here's another version
> of the diff that applies on top of the current main branch.

Why should differing paths be an error?

I think you can just assume that the +++ path is the one which
identifies the patch target, provided it is not "/dev/null".

Consider how 'git diff' represents renames:

diff --git a/foo b/bar
similarity index 50%
rename from foo
rename to bar
index 257cc56..3bd1f0e 100644
--- a/foo
+++ b/bar
@@ -1 +1,2 @@
 foo
+bar