Re: [PATCH] t1020-subdirectory: test alias expansion in a subdirectory

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

 



Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes:

> On Mon, Nov 08, 2010 at 09:32:03AM +0100, Michael J Gruber wrote:
>> Add a test for alias expansion in a subdirectory of the worktree.
>> 
>> Signed-off-by: Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx>
>> 
>> ---
>>     65f3a9e (Remove all logic from get_git_work_tree(), 2010-11-01) breaks this test,
>>     which is why I am adding it.
>
> How about squashing this in?
>
> --8<--
> Subject: Allow set_git_work_tree() to be called more than once
>
> Usually one of the setup functions is called once. However alias
> handling code needs to look ahead in $GIT_DIR/config for aliases. So
> set_git_work_tree() may be called twice: once when alias is searched,
> once when the actual command is run.
>
> Loosen the condition and let it through. We can stricten it back when
> alias handling is fixed.

Sounds like sweeping something under rug.  

Without this hack, alias does not work, but if your plan is to rework this
part right when alias is fixed, then what's the point of loosening it?
Either way your alias is broken, no?

Shouldn't it at least make sure that the function is giving a consistent
picture to the outside world between the time it was called for the first
time and the second time?  E.g.  the second time around new-work-tree must
be the same as whatever was given the first time, or something.

> ---
> diff --git a/environment.c b/environment.c
> index 6db00da..f0d0b07 100644
> --- a/environment.c
> +++ b/environment.c
> @@ -128,8 +128,6 @@ const char *get_git_dir(void)
>  	return git_dir;
>  }
>  
> -static int git_work_tree_initialized;
> -
>  /*
>   * Note.  This works only before you used a work tree.  This was added
>   * primarily to support git-clone to work in a new repository it just
> @@ -137,9 +135,7 @@ static int git_work_tree_initialized;
>   */
>  void set_git_work_tree(const char *new_work_tree)
>  {
> -	if (git_work_tree_initialized)
> -		die("internal error: work tree has already been set");
> -	git_work_tree_initialized = 1;
> +	free(work_tree);
>  	work_tree = xstrdup(make_absolute_path(new_work_tree));
>  }
>  
> --8<--
> -- 
> 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]