Jeff King <p...@peff.net> writes:

> So totally orthogonal to your bug, I wonder if we ought to be doing:
>
> diff --git a/sha1_file.c b/sha1_file.c
> index 057262d46e..0b76233aa7 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -530,11 +530,11 @@ void prepare_alt_odb(void)
>       if (alt_odb_tail)
>               return;
>  
> -     alt = getenv(ALTERNATE_DB_ENVIRONMENT);
> -     if (!alt) alt = "";
> -
>       alt_odb_tail = &alt_odb_list;
> -     link_alt_odb_entries(alt, strlen(alt), PATH_SEP, NULL, 0);
> +
> +     alt = getenv(ALTERNATE_DB_ENVIRONMENT);
> +     if (alt)
> +             link_alt_odb_entries(alt, strlen(alt), PATH_SEP, NULL, 0);
>  
>       read_info_alternates(get_object_directory(), 0);
>  }
>
> to avoid hitting link_alt_odb_entries() at all when there are no
> entries.

Sounds sane.

Reply via email to