Commit Diff


commit - d953d89953407bff647a8992583c9f0850f5771c
commit + de3c84b6c8bbf16375d2e224b441bf38fece5b9c
blob - 50086714a7aed4957c6779432a43f73fa7a56f8d
blob + c2f5e271570a023ed95b95d16eff2352256e44ad
--- 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 - f85a91adb23d2606865334bb163b48fcea0ad221
blob + 6964e064bc5e24d6fc7175115a93d194855b9086
--- lib/patch.c
+++ lib/patch.c
@@ -376,8 +376,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;
@@ -411,7 +411,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);
@@ -509,7 +509,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:
@@ -534,7 +534,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;
@@ -582,7 +583,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;