Skip to content

Commit db5d1b9

Browse files
committed
Merge branch 'sp/add-patch-with-fewer-the-repository' into seen
Reduce dependency on `the_repository` in add-patch.c file. * sp/add-patch-with-fewer-the-repository: add-patch: use repository instance from add_i_state instead of the_repository
2 parents b70dbdf + 3cfe355 commit db5d1b9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

add-patch.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
558558
strvec_push(&args,
559559
/* could be on an unborn branch */
560560
!strcmp("HEAD", s->revision) &&
561-
repo_get_oid(the_repository, "HEAD", &oid) ?
562-
empty_tree_oid_hex(the_repository->hash_algo) : s->revision);
561+
repo_get_oid(s->r, "HEAD", &oid) ?
562+
empty_tree_oid_hex(s->r->hash_algo) : s->revision);
563563
}
564564
color_arg_index = args.nr;
565565
/* Use `--no-color` explicitly, just in case `diff.color = always`. */
@@ -1271,7 +1271,7 @@ static int edit_hunk_manually(struct add_p_state *s, struct hunk *hunk)
12711271
"removed, then the edit is\n"
12721272
"aborted and the hunk is left unchanged.\n"));
12731273

1274-
if (strbuf_edit_interactively(the_repository, &s->buf,
1274+
if (strbuf_edit_interactively(s->r, &s->buf,
12751275
"addp-hunk-edit.diff", NULL) < 0)
12761276
return -1;
12771277

@@ -1679,7 +1679,7 @@ static size_t patch_update_file(struct add_p_state *s,
16791679
if (file_diff->hunk_nr) {
16801680
if (rendered_hunk_index != hunk_index) {
16811681
if (use_pager) {
1682-
setup_pager(the_repository);
1682+
setup_pager(s->r);
16831683
sigchain_push(SIGPIPE, SIG_IGN);
16841684
}
16851685
render_hunk(s, hunk, 0, colored, &s->buf);

0 commit comments

Comments
 (0)