Download raw body.
two small fixes for got patch
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",
two small fixes for got patch