Subject: Re: [PATCH 2/2] git-p4: fix handling of multi-word P4EDITOR

From: Junio C Hamano <[email-masked]>
Date: Thu, 07 May 2015 14:16:22 -0700

Junio C Hamano <[email-masked]> writes:

> Perhaps something like this would work (totally untested)?
>
> diff --git a/t/t9805-git-p4-skip-submit-edit.sh b/t/t9805-git-p4-skip-submit-edit.sh
> index 8931188..a47b44b 100755
> --- a/t/t9805-git-p4-skip-submit-edit.sh
> +++ b/t/t9805-git-p4-skip-submit-edit.sh
> @@ -90,8 +90,9 @@ test_expect_success 'no config, edited' '
>  		cd "$git" &&
>  		echo line >>file1 &&
>  		git commit -a -m "change 5" &&
> -		P4EDITOR="$TRASH_DIRECTORY/ed.sh" &&
> -		export P4EDITOR &&
> +		customEditor="$TRASH_DIRECTORY/ed.sh" &&
> +		P4EDITOR="\$customEditor" &&

Sorry, this inside should be quoted a bit more so that the executed
command becomes

       sh -c '"$customEditor" "$@"'

i.e. the shell at the beginning of system sees "$customEditor"
(including the double quotes) as a quoted variable, expand the
environment variable as exported, and treat it as the path to
the program.  Again untested but I think

	P4EDITOR="\"\$customEditor\"" &&

should do the work.

> +		export customEditor P4EDITOR &&
>  		git p4 submit &&
>  		p4 changes //depot/... >wc &&
>  		test_line_count = 5 wc