aboutsummaryrefslogtreecommitdiffstats
path: root/add-patch.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-08-13 11:13:25 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-13 10:01:00 -0700
commit419dbb29d82b78bcaf0ff22ac7d5db7d1c327575 (patch)
tree43c8322954e0ad8da0e2e60fd3e692ede6c89b92 /add-patch.c
parentpath: expose `do_git_common_path()` as `repo_common_pathv()` (diff)
downloadgit-419dbb29d82b78bcaf0ff22ac7d5db7d1c327575.tar.gz
git-419dbb29d82b78bcaf0ff22ac7d5db7d1c327575.zip
editor: do not rely on `the_repository` for interactive edits
We implicitly rely on `the_repository` when editing a file interactively because we call `git_path()`. Adapt the function to instead take a `struct repository` as a parameter so that we can remove this hidden dependency. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'add-patch.c')
-rw-r--r--add-patch.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/add-patch.c b/add-patch.c
index 46f6bddfe5..218dda3e79 100644
--- a/add-patch.c
+++ b/add-patch.c
@@ -1140,7 +1140,8 @@ static int edit_hunk_manually(struct add_p_state *s, struct hunk *hunk)
"removed, then the edit is\n"
"aborted and the hunk is left unchanged.\n"));
- if (strbuf_edit_interactively(&s->buf, "addp-hunk-edit.diff", NULL) < 0)
+ if (strbuf_edit_interactively(the_repository, &s->buf,
+ "addp-hunk-edit.diff", NULL) < 0)
return -1;
/* strip out commented lines */