On 02/28, Nguyễn Thái Ngọc Duy wrote:
> v3 fixes comment style. Also since Brandon raised a question about
> shared_root, it's obviously not a good name, so I renamed it to
> commondir.
Thanks, its a bit clearer and more consistent with the rest of the
terminology we already have :)
>
> I still keep the delete patch 2/4, but I move the repo_setup_env()
> deletion back to 1/4 so all env logic is in one patch (the
> introduction of new helper functions in 1/4 and deletion in 2/4 are
> still diff noise if 2/4 is completely merged back).
>
> Interdiff:
>
> diff --git a/environment.c b/environment.c
> index 47c6e31559..b2128c1188 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -149,7 +149,8 @@ static char *expand_namespace(const char *raw_namespace)
> return strbuf_detach(&buf, NULL);
> }
>
> -/* Wrapper of getenv() that returns a strdup value. This value is kept
> +/*
> + * Wrapper of getenv() that returns a strdup value. This value is kept
> * in argv to be freed later.
> */
> static const char *getenv_safe(struct argv_array *argv, const char *name)
> @@ -170,7 +171,7 @@ void setup_git_env(const char *git_dir)
> struct set_gitdir_args args = { NULL };
> struct argv_array to_free = ARGV_ARRAY_INIT;
>
> - args.shared_root = getenv_safe(&to_free, GIT_COMMON_DIR_ENVIRONMENT);
> + args.commondir = getenv_safe(&to_free, GIT_COMMON_DIR_ENVIRONMENT);
> args.object_dir = getenv_safe(&to_free, DB_ENVIRONMENT);
> args.graft_file = getenv_safe(&to_free, GRAFT_ENVIRONMENT);
> args.index_file = getenv_safe(&to_free, INDEX_ENVIRONMENT);
> diff --git a/repository.c b/repository.c
> index c555dacad2..4f44384dde 100644
> --- a/repository.c
> +++ b/repository.c
> @@ -27,15 +27,15 @@ static void expand_base_dir(char **out, const char *in,
> }
>
> static void repo_set_commondir(struct repository *repo,
> - const char *shared_root)
> + const char *commondir)
> {
> struct strbuf sb = STRBUF_INIT;
>
> free(repo->commondir);
>
> - if (shared_root) {
> + if (commondir) {
> repo->different_commondir = 1;
> - repo->commondir = xstrdup(shared_root);
> + repo->commondir = xstrdup(commondir);
> return;
> }
>
> @@ -58,7 +58,7 @@ void repo_set_gitdir(struct repository *repo,
> repo->gitdir = xstrdup(gitfile ? gitfile : root);
> free(old_gitdir);
>
> - repo_set_commondir(repo, o->shared_root);
> + repo_set_commondir(repo, o->commondir);
> expand_base_dir(&repo->objects.objectdir, o->object_dir,
> repo->commondir, "objects");
> free(repo->objects.alternate_db);
> diff --git a/repository.h b/repository.h
> index 07e8971428..e05a77a099 100644
> --- a/repository.h
> +++ b/repository.h
> @@ -81,7 +81,7 @@ struct repository {
> extern struct repository *the_repository;
>
> struct set_gitdir_args {
> - const char *shared_root;
> + const char *commondir;
> const char *object_dir;
> const char *graft_file;
> const char *index_file;
>
> Nguyễn Thái Ngọc Duy (4):
> repository.c: move env-related setup code back to environment.c
> repository.c: delete dead functions
> sha1_file.c: move delayed getenv(altdb) back to setup_git_env()
> repository: delete ignore_env member
>
> cache.h | 2 +-
> environment.c | 31 +++++++++++++++++--
> object-store.h | 5 ++-
> object.c | 1 +
> repository.c | 84 ++++++++++++++++++++++++--------------------------
> repository.h | 21 +++++++------
> setup.c | 3 +-
> sha1_file.c | 6 +---
> 8 files changed, 87 insertions(+), 66 deletions(-)
>
> --
> 2.16.1.399.g632f88eed1
>
--
Brandon Williams