]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sp/add-patch-with-fewer-the-repository'
authorJunio C Hamano <gitster@pobox.com>
Tue, 7 Apr 2026 21:59:26 +0000 (14:59 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 Apr 2026 21:59:26 +0000 (14:59 -0700)
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

1  2 
add-patch.c

diff --cc add-patch.c
index 4e28e5c18786e28c425fcd987ccce7a2b59b0db7,30df920723a3a9df4d1fdee20864c2c3f6a90715..f27edcbe8d415154f849cfc7b572efd9bb069dcf
@@@ -558,8 -434,8 +558,8 @@@ static int parse_diff(struct add_p_stat
                strvec_push(&args,
                            /* could be on an unborn branch */
                            !strcmp("HEAD", s->revision) &&
-                           repo_get_oid(the_repository, "HEAD", &oid) ?
-                           empty_tree_oid_hex(the_repository->hash_algo) : s->revision);
 -                          repo_get_oid(s->s.r, "HEAD", &oid) ?
 -                          empty_tree_oid_hex(s->s.r->hash_algo) : s->revision);
++                          repo_get_oid(s->r, "HEAD", &oid) ?
++                          empty_tree_oid_hex(s->r->hash_algo) : s->revision);
        }
        color_arg_index = args.nr;
        /* Use `--no-color` explicitly, just in case `diff.color = always`. */
@@@ -1271,7 -1147,7 +1271,7 @@@ static int edit_hunk_manually(struct ad
                                "removed, then the edit is\n"
                                "aborted and the hunk is left unchanged.\n"));
  
-       if (strbuf_edit_interactively(the_repository, &s->buf,
 -      if (strbuf_edit_interactively(s->s.r, &s->buf,
++      if (strbuf_edit_interactively(s->r, &s->buf,
                                      "addp-hunk-edit.diff", NULL) < 0)
                return -1;
  
@@@ -1679,7 -1551,7 +1679,7 @@@ static size_t patch_update_file(struct 
                if (file_diff->hunk_nr) {
                        if (rendered_hunk_index != hunk_index) {
                                if (use_pager) {
-                                       setup_pager(the_repository);
 -                                      setup_pager(s->s.r);
++                                      setup_pager(s->r);
                                        sigchain_push(SIGPIPE, SIG_IGN);
                                }
                                render_hunk(s, hunk, 0, colored, &s->buf);