On 02/27, Nguyễn Thái Ngọc Duy wrote:
> This variable was added because the repo_set_gitdir() was created to
> cover both submodule and main repos, but these two are initialized a
> bit differently so ignore_env == 0 means main repo, while ignore_env
> != 0 is submodules.
> 
> Since the difference part (env variables) has been moved out of
> repo_set_gitdir(), this function works the same way for both repo
> types and ignore_env is not needed anymore.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
> ---
>  repository.c | 4 +---
>  repository.h | 9 ---------
>  2 files changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/repository.c b/repository.c
> index e326f0fcbc..c555dacad2 100644
> --- a/repository.c
> +++ b/repository.c
> @@ -12,7 +12,7 @@ static struct repository the_repo = {
>       NULL, NULL, NULL,
>       &the_index,
>       &hash_algos[GIT_HASH_SHA1],
> -     0, 0
> +     0
>  };
>  struct repository *the_repository = &the_repo;
>  
> @@ -139,8 +139,6 @@ int repo_init(struct repository *repo, const char 
> *gitdir, const char *worktree)
>       struct repository_format format;
>       memset(repo, 0, sizeof(*repo));
>  
> -     repo->ignore_env = 1;
> -
>       INIT_LIST_HEAD(&repo->objects.packed_git_mru);
>  
>       if (repo_init_gitdir(repo, gitdir))
> diff --git a/repository.h b/repository.h
> index b1da2a6384..07e8971428 100644
> --- a/repository.h
> +++ b/repository.h
> @@ -73,15 +73,6 @@ struct repository {
>       const struct git_hash_algo *hash_algo;
>  
>       /* Configurations */
> -     /*
> -      * Bit used during initialization to indicate if repository state (like
> -      * the location of the 'objectdir') should be read from the
> -      * environment.  By default this bit will be set at the begining of
> -      * 'repo_init()' so that all repositories will ignore the environment.
> -      * The exception to this is 'the_repository', which doesn't go through
> -      * the normal 'repo_init()' process.
> -      */
> -     unsigned ignore_env:1;

Nice, glad to see this get a bit less complicated.  I'm also very glad I
didn't end up using this variable when doing anything else but
initializing a repo object otherwise you would have had a bit more
difficult time getting rid of it :)

Thanks!

>  
>       /* Indicate if a repository has a different 'commondir' from 'gitdir' */
>       unsigned different_commondir:1;
> -- 
> 2.16.1.435.g8f24da2e1a
> 

-- 
Brandon Williams

Reply via email to