Re: [PATCH v6 03/11] replay: stop using `the_repository`
- From
Elijah Newren <newren@gmail.com>
- Date
- Nov 20, 2025, 07:01 UTC
- Message-ID
- <CABPp-BH7E1Bh2g0vR3T4NEsv34DvFQPzMuJSsqtOAaWY-fFCxg@mail.gmail.com>
- In-Reply-To
- <20251027-b4-pks-history-builtin-v6-3-407dd3f57ad3@pks.im>
On Mon, Oct 27, 2025 at 4:34 AM Patrick Steinhardt <ps@pks.im> wrote:
> > In `create_commit()` we're using `the_repository` even though we already > have a repository passed to use as an argument. Fix this.
I feel like I've fixed this multiple times, but it keeps coming back. In fact, I have this same fix locally in my replay-edit work. Thanks for fixing it.
Show 5 quoted lines
> > Note that we still cannot get rid of `USE_THE_REPOSITORY_VARIABLE`. This > is because we use `DEFAULT_ABBREV and `get_commit_output_encoding()`, > both of which are stored as global variables that can be modified via > the Git configuration.
Indeed.
Going on a tangent for a second...I feel like I've had to remove "the_repository" from builtin/replay.c multiple times. In my local replay-edit work, I actually added a "#define the_repository DO_NOT_USE_THE_REPOSITORY" in builtin/replay.c, after all the header includes, because the_repository isn't what builtin/replay.c is using, it's these other two things that are also only included if USE_THE_REPOSITORY_VARIABALE is defined. That obviously doesn't need to be part of your series, but what would you think if I were to submit that? Is it too ugly/weird of a way to avoid the_repository being added back to builtin/replay.c so we can stop having to remove it again?
Show 21 quoted lines
> Signed-off-by: Patrick Steinhardt <ps@pks.im> > --- > replay.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/replay.c b/replay.c > index 98be33b854..58fdc20140 100644 > --- a/replay.c > +++ b/replay.c > @@ -62,7 +62,7 @@ struct commit *replay_create_commit(struct repository *repo, > obj = parse_object(repo, &ret); > > out: > - repo_unuse_commit_buffer(the_repository, based_on, message); > + repo_unuse_commit_buffer(repo, based_on, message); > free_commit_extra_headers(extra); > free_commit_list(parents); > strbuf_release(&msg); > > -- > 2.51.1.930.gacf6e81ea2.dirty
Patch looks good.