Re: [PATCH] setup.c: set workdir when gitdir is not default

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

 



On Thu, Sep 4, 2014 at 5:42 AM, Max Kirillov <max@xxxxxxxxxx> wrote:
> diff --git a/setup.c b/setup.c
> index 0a22f8b..bcf4e31 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -508,8 +508,10 @@ static const char *setup_discovered_git_dir(const char *gitdir,
>
>         /* #0, #1, #5, #8, #9, #12, #13 */
>         set_git_work_tree(".");

I wonder if we should setenv(GIT_WORK_TREE_) from inside this function
instead. A quick glance over 'git grep set_git_work_tree' gives me the
impression that it's safe to do so, and could cover future bugs
similar to this.

> -       if (strcmp(gitdir, DEFAULT_GIT_DIR_ENVIRONMENT))
> +       if (strcmp(gitdir, DEFAULT_GIT_DIR_ENVIRONMENT)) {
>                 set_git_dir(gitdir);
> +               setenv(GIT_WORK_TREE_ENVIRONMENT, get_git_work_tree(), 1);
> +       }
>         inside_git_dir = 0;
>         inside_work_tree = 1;
>         if (offset == len)
-- 
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]