Re: [RFC/PATCH] handle_alias: provide GIT_CWD to !alias

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

 



Nguyen Thai Ngoc Duy venit, vidit, dixit 13.04.2011 15:12:
> On Wed, Apr 13, 2011 at 8:05 PM, Michael J Gruber
> <git@xxxxxxxxxxxxxxxxxxxx> wrote:
>> -                       ret = run_command_v_opt(alias_argv, RUN_USING_SHELL);
>> +                       strbuf_addstr(&sb, "GIT_CWD=");
>> +                       if (subdir)
>> +                               strbuf_addstr(&sb, subdir);
>> +                       env[0] = sb.buf;
>> +                       env[1] = NULL;
>> +                       ret = run_command_v_opt_cd_env(alias_argv, RUN_USING_SHELL, NULL, env);
>> +                       strbuf_release(&sb);
>>                        if (ret >= 0)   /* normal exit */
>>                                exit(ret);
> 
> subdir can be NULL. I'm not sure if it can be empty string though. May

I'm pretty sure that my "if (subdir)" would catch that...

> need a check and set it to '.' so "cd $GIT_CWD" does not go back to
> $HOME.

Well, with the current implementation you get empty or the subdir so
that you can easily "test -n $GIT_CWD". If you want to cd around you can
do "cd ./$GIT_CWD" unconditionally. I think this is more useful than
having a "." there.

Michael
--
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]