Re: [PATCH 44/47] Remove all logic from get_git_work_tree()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/12/22 Junio C Hamano <gitster@xxxxxxxxx>:
>> Â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?
>

While the assertion sounds good, it does not work well. The old
function can return NULL in bare repos. is_bare_repository() and
is_inside_work_tree() expect NULL from get_git_work_tree() sometimes.

I'll see if I can move is_inside_work_tree() over environment.c (so
that both callers can access work_tree var directly) and have a clean
"make test". It does not look feasible though because of the static
variable inside_work_tree in setup.c.
-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]