Subject: Re: [PATCH v2 0/3] nd/clear-gitenv-upon-use-of-alias

From: Johannes Sixt <[email-masked]>
Date: Wed, 23 Dec 2015 21:37:04 +0100

Am 23.12.2015 um 10:37 schrieb Jeff King:
> The second line comes from handle_alias itself. It calls
> die_errno whenever run_command returns a negative value.
> However, only -1 indicates a syscall error where errno has
> something useful (note that it says the useless "success"
> above). Instead, we treat negative returns from run_command
> (except for -1) as a normal code to be passed to exit.
>
> Signed-off-by: Jeff King <[email-masked]>
> ---
>   git.c         | 2 +-
>   run-command.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/git.c b/git.c
> index 6ed824c..34a18a3 100644
> --- a/git.c
> +++ b/git.c
> @@ -252,7 +252,7 @@ static int handle_alias(int *argcp, const char ***argv)
>   			alias_argv[argc] = NULL;
>
>   			ret = run_command_v_opt(alias_argv, RUN_USING_SHELL);
> -			if (ret >= 0)   /* normal exit */
> +			if (ret != -1)  /* normal exit */

Why does this make a difference? We only ever return -1, zero, or a 
positive value from run_command/finish_command/wait_or_whine, as far as 
I can see.

>   				exit(ret);
>
>   			die_errno("While expanding alias '%s': '%s'",

-- Hannes