Re: [PATCH v2 06/21] environment: make `get_git_work_tree()` accept a repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 11, 2024 at 10:15:06AM -0500, Justin Tobler wrote:
> On 24/08/30 11:09AM, Patrick Steinhardt wrote:
> > 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@xxxxxx>
> > ---
> [snip]
> > 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?

I think it still makes sense to keep it, mostly because we also have
accessor functions for the other paths, too. It would feel weirdly
asymmetric to have `repo_get_git_dir()` but not `repo_get_work_tree()`,
in my opinion.

Patrick




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux