Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c

2018-02-27 Thread Duy Nguyen
On Tue, Feb 27, 2018 at 1:57 AM, Eric Sunshine wrote: > Can: > > char *old_gitdir = repo->gitdir; > repo->gitdir = xstrdup(...); > free(old_gitdir); > > be simplified to: > > free(repo->gitdir); > repo->gitdir = xstrdup(...); > > ? No because I think

Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c

2018-02-27 Thread Duy Nguyen
On Tue, Feb 27, 2018 at 1:57 AM, Eric Sunshine wrote: >> + repo_set_commondir(repo, o->shared_root); > > The repo_set_gitdir() prototype (below) makes it seem as if the last > argument ('o', in this case) is optional, presumably by passing in > NULL, however, this

Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c

2018-02-26 Thread Duy Nguyen
On Tue, Feb 27, 2018 at 3:30 AM, Stefan Beller wrote: >> diff --git a/setup.c b/setup.c >> index c5d55dcee4..6fac1bb58a 100644 >> --- a/setup.c >> +++ b/setup.c >> @@ -1116,8 +1116,7 @@ const char *setup_git_directory_gently(int *nongit_ok) >> const

Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c

2018-02-26 Thread Stefan Beller
> diff --git a/setup.c b/setup.c > index c5d55dcee4..6fac1bb58a 100644 > --- a/setup.c > +++ b/setup.c > @@ -1116,8 +1116,7 @@ const char *setup_git_directory_gently(int *nongit_ok) > const char *gitdir = getenv(GIT_DIR_ENVIRONMENT); > if (!gitdir) >

Re: [PATCH 1/4] repository.c: move env-related setup code back to environment.c

2018-02-26 Thread Eric Sunshine
On Mon, Feb 26, 2018 at 5:30 AM, Nguyễn Thái Ngọc Duy wrote: > It does not make sense that generic repository code contains handling > of environment variables, which are specific for the main repository > only. Refactor repo_set_gitdir() function to take $GIT_DIR and >

[PATCH 1/4] repository.c: move env-related setup code back to environment.c

2018-02-26 Thread Nguyễn Thái Ngọc Duy
It does not make sense that generic repository code contains handling of environment variables, which are specific for the main repository only. Refactor repo_set_gitdir() function to take $GIT_DIR and optionally _all_ other customizable paths. These optional paths can be NULL and will be