Re: [PATCH 44/47] Remove all logic from get_git_work_tree()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 22, 2010, 01:56 UTC
- Message-ID
- <7vpqsu6059.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1290785563-15339-45-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 21 quoted lines
> This logic is now only used by cmd_init_db(). setup_* functions do not
> rely on it any more. Move all the logic to cmd_init_db() and turn
> get_git_work_tree() into a simple function.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> diff --git a/environment.c b/environment.c
> index d811049..149c132 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -137,36 +137,20 @@ static int git_work_tree_initialized;
> */
> ...
> const char *get_git_work_tree(void)
> {
> - if (startup_info && !startup_info->setup_explicit) {
> -...
> - }
> return work_tree;
> }Would it be a bug in the new set-up code if this function gets called and work_tree is still NULL?
There are quite a few callers that call get_git_work_tree() and expect that it will always return a non NULL pointer. Perhaps we would want an assertion here?