Re: [PATCH v2 06/21] environment: make `get_git_work_tree()` accept a repository
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Sep 11, 2024, 15:15 UTC
- Message-ID
- <wnorpwj5stwekbdvqzz6oyom5ppqhcsg3afvujslmy45r2djdb@sn6voa5d2e5v>
- In-Reply-To
- <22e9dcb28a981eaa1a37a8b41e8d061347ed6c2e.1725008898.git.ps@pks.im>
On 24/08/30 11:09AM, Patrick Steinhardt wrote:
Show 8 quoted lines
> The `get_git_work_tree()` function retrieves the path of the work tree > of `the_repository`. Make it accept a `struct repository` such that it > can work on arbitrary repositories and make it part of the repository > subsystem. This reduces our reliance on `the_repository` and clarifies > scope. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > ---
[snip]
Show 13 quoted lines
> diff --git a/repository.c b/repository.c
> index cdefcb4002d..92238da3d9e 100644
> --- a/repository.c
> +++ b/repository.c
> @@ -126,6 +126,11 @@ const char *repo_get_graft_file(struct repository *repo)
> return repo->graft_file;
> }
>
> +const char *repo_get_work_tree(struct repository *repo)
> +{
> + return repo->worktree;
> +}
> +Now that `repo_get_work_tree()` is accepting a `struct repository`, it's only functioning as a simple accessor and seems somewhat unneccesary. Is it preferrable to keep this?
-Justin