Re: [PATCH v2 01/21] environment: make `get_git_dir()` accept a repository
- From
karthik nayak <karthik.188@gmail.com>
- Date
- Sep 11, 2024, 21:12 UTC
- Message-ID
- <CAOLa=ZQxVtFrZqFJ+Q+0ifj5h+x-7-ZE6viD9OUyNr2CvE7s-A@mail.gmail.com>
- In-Reply-To
- <a1969c5b0734cacd0316c34ef3d3b1939f521cd4.1725008898.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
[snip]
Show 12 quoted lines
> diff --git a/repository.c b/repository.c
> index 9825a308993..6f43f2e8344 100644
> --- a/repository.c
> +++ b/repository.c
> @@ -91,6 +91,13 @@ static void expand_base_dir(char **out, const char *in,
> *out = xstrfmt("%s/%s", base_dir, def_in);
> }
>
> +const char *repo_get_git_dir(struct repository *repo)
> +{
> + if (!repo->gitdir)
> + BUG("git environment hasn't been setup");Shouldn't this message be more generic now? Since this function can be used with any repository?
Show 6 quoted lines
> + return repo->gitdir;
> +}
> +
> static void repo_set_commondir(struct repository *repo,
> const char *commondir)
> {[snip]
Rest of the patch looks good. Thanks