"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>, gameoftrees@openbsd.org
Date:
Sat, 12 Mar 2022 12:35:04 +0100

Download raw body.

Thread
On Sat, Mar 12, 2022 at 10:56:32AM +0100, Stefan Sperling wrote:
> You do not yet have to parse any of these headers. You could just treat
> them as noise, for now.

I think my suggestion boils down to this diff.
The patch tests keep passing.

What do you think could go wrong if we did this?
I don't see a problem.

diff ca6444c5b3830627626458222ef3f16852e3505f /home/stsp/src/got
blob - 64f2cb93558b933d2ffdcc0da7dedecf78d8ee52
file + include/got_error.h
--- include/got_error.h
+++ include/got_error.h
@@ -165,8 +165,7 @@
 #define GOT_ERR_PATCH_MALFORMED	147
 #define GOT_ERR_PATCH_TRUNCATED	148
 #define GOT_ERR_PATCH_DONT_APPLY 149
-#define GOT_ERR_PATCH_PATHS_DIFFER 150
-#define GOT_ERR_NO_PATCH	151
+#define GOT_ERR_NO_PATCH	150
 
 static const struct got_error {
 	int code;
@@ -346,8 +345,6 @@ static const struct got_error {
 	{ GOT_ERR_PATCH_MALFORMED, "malformed patch" },
 	{ GOT_ERR_PATCH_TRUNCATED, "patch truncated" },
 	{ GOT_ERR_PATCH_DONT_APPLY, "patch doesn't apply" },
-	{ GOT_ERR_PATCH_PATHS_DIFFER, "the paths mentioned in the patch "
-	    "are different." },
 	{ GOT_ERR_NO_PATCH, "no patch found" },
 };
 
blob - 6cc85331d4129d6f7dfec267d04e16173c9608a6
file + lib/patch.c
--- lib/patch.c
+++ lib/patch.c
@@ -415,9 +415,6 @@ apply_patch(struct got_worktree *worktree, struct got_
 		err = got_worktree_schedule_delete(worktree, &paths,
 		    0, NULL, delete_cb, delete_arg, repo, 0, 0);
 		goto done;
-	} else if (p->old != NULL && strcmp(p->old, p->new)) {
-		err = got_error(GOT_ERR_PATCH_PATHS_DIFFER);
-		goto done;
 	}
 
 	if (asprintf(&template, "%s/got-patch",