Subject: Re: [PATCH v2 2/4] repository.c: delete dead functions

From: Brandon Williams <[email-masked]>
Date: Tue, 27 Feb 2018 12:10:46 -0800

On 02/27, Nguyễn Thái Ngọc Duy wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>

These could technically be removed in the previous patch, it may make
understanding what is happening in the previous patch a bit clearer too.

> ---
>  repository.c | 45 ---------------------------------------------
>  1 file changed, 45 deletions(-)
> 
> diff --git a/repository.c b/repository.c
> index 343efe7282..7654b8ada9 100644
> --- a/repository.c
> +++ b/repository.c
> @@ -16,51 +16,6 @@ static struct repository the_repo = {
>  };
>  struct repository *the_repository = &the_repo;
>  
> -static char *git_path_from_env(const char *envvar, const char *git_dir,
> -			       const char *path, int fromenv)
> -{
> -	if (fromenv) {
> -		const char *value = getenv(envvar);
> -		if (value)
> -			return xstrdup(value);
> -	}
> -
> -	return xstrfmt("%s/%s", git_dir, path);
> -}
> -
> -static int find_common_dir(struct strbuf *sb, const char *gitdir, int fromenv)
> -{
> -	if (fromenv) {
> -		const char *value = getenv(GIT_COMMON_DIR_ENVIRONMENT);
> -		if (value) {
> -			strbuf_addstr(sb, value);
> -			return 1;
> -		}
> -	}
> -
> -	return get_common_dir_noenv(sb, gitdir);
> -}
> -
> -static void repo_setup_env(struct repository *repo)
> -{
> -	struct strbuf sb = STRBUF_INIT;
> -
> -	repo->different_commondir = find_common_dir(&sb, repo->gitdir,
> -						    !repo->ignore_env);
> -	free(repo->commondir);
> -	repo->commondir = strbuf_detach(&sb, NULL);
> -	raw_object_store_clear(&repo->objects);
> -	repo->objects.objectdir =
> -		git_path_from_env(DB_ENVIRONMENT, repo->commondir,
> -				  "objects", !repo->ignore_env);
> -	free(repo->graft_file);
> -	repo->graft_file = git_path_from_env(GRAFT_ENVIRONMENT, repo->commondir,
> -					     "info/grafts", !repo->ignore_env);
> -	free(repo->index_file);
> -	repo->index_file = git_path_from_env(INDEX_ENVIRONMENT, repo->gitdir,
> -					     "index", !repo->ignore_env);
> -}
> -
>  static void expand_base_dir(char **out, const char *in,
>  			    const char *base_dir, const char *def_in)
>  {
> -- 
> 2.16.1.435.g8f24da2e1a
> 

-- 
Brandon Williams