Commit Diff


commit - 36751b1b2e8389b739a0f7aacf7d8e5371d898bf
commit + d955343d21ec47956137ebce96b31ce9c0de5669
blob - 3e66e251220b096cd82830703d4481ddfc399307
blob + 5939e9366900091eb56fe2aa3cdbe21f4f7a63eb
--- got/got.c
+++ got/got.c
@@ -7220,7 +7220,7 @@ cmd_patch(int argc, char *argv[])
 #endif
 
 	error = got_patch(patchfd, worktree, repo, &print_remove_status,
-	    &add_progress);
+	    NULL, &add_progress, NULL);
 
 done:
 	if (repo) {
blob - 3f56d45c54c3ff202d4e7db59288e3ec6717ed78
blob + 04a23fc7f7da83078d23e8ec24820ce98aa43702
--- include/got_patch.h
+++ include/got_patch.h
@@ -22,4 +22,4 @@
  */
 const struct got_error *
 got_patch(int, struct got_worktree *, struct got_repository *,
-    got_worktree_delete_cb, got_worktree_checkout_cb);
+    got_worktree_delete_cb, void *, got_worktree_checkout_cb, void *);
blob - 672f8dac069d4fdcde1088037bbf462287cd0264
blob + 9bfe37463cbe64005617a3395ea55e551360f8d1
--- lib/patch.c
+++ lib/patch.c
@@ -377,8 +377,8 @@ apply_hunk(FILE *tmp, struct got_patch_hunk *h, long *
 
 static const struct got_error *
 apply_patch(struct got_worktree *worktree, struct got_repository *repo,
-    struct got_patch *p, got_worktree_delete_cb delete_cb,
-    got_worktree_checkout_cb add_cb)
+    struct got_patch *p, got_worktree_delete_cb delete_cb, void *delete_arg,
+    got_worktree_checkout_cb add_cb, void *add_arg)
 {
 	const struct got_error *err = NULL;
 	struct got_pathlist_head paths;
@@ -412,7 +412,7 @@ apply_patch(struct got_worktree *worktree, struct got_
 		 * the lines but just schedule the removal.
 		 */
 		err = got_worktree_schedule_delete(worktree, &paths,
-		    0, NULL, delete_cb, NULL, repo, 0, 0);
+		    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);
@@ -510,7 +510,7 @@ rename:
 
 	if (p->old == NULL)
 		err = got_worktree_schedule_add(worktree, &paths,
-		    add_cb, NULL, repo, 1);
+		    add_cb, add_arg, repo, 1);
 	else
 		printf("M  %s\n", path); /* XXX */
 done:
@@ -535,7 +535,8 @@ done:
 
 const struct got_error *
 got_patch(int fd, struct got_worktree *worktree, struct got_repository *repo,
-    got_worktree_delete_cb delete_cb, got_worktree_checkout_cb add_cb)
+    got_worktree_delete_cb delete_cb, void *delete_arg,
+    got_worktree_checkout_cb add_cb, void *add_arg)
 {
 	const struct got_error *err = NULL;
 	struct imsgbuf *ibuf;
@@ -583,7 +584,8 @@ got_patch(int fd, struct got_worktree *worktree, struc
 		if (err || done)
 			break;
 
-		err = apply_patch(worktree, repo, &p, delete_cb, add_cb);
+		err = apply_patch(worktree, repo, &p, delete_cb, delete_arg,
+		    add_cb, add_arg);
 		patch_free(&p);
 		if (err)
 			break;