On Tue, 19 Apr 2005, Petr Baudis wrote:
> 
> this patch fixes git-merge-one-file-script's automerge.

Nope, it doesn't. The original may not have worked, but neither does your 
vesion either: the reason for the exit 1 is that the _script_ should exit, 
but when you put it in a sub-shell with (..), now only the subshell exits 
with an error code, and we'll happily continue to do the following line 
which we should not do (since the merge failed).

> Signed-off-by: Petr Baudis <[EMAIL PROTECTED]>
> 
> git-merge-one-file-script: 7ebf5dac4c69043cd2ff89bf7ee552152802f8d1
> --- a/git-merge-one-file-script
> +++ b/git-merge-one-file-script
> @@ -43,7 +43,7 @@ case "${1:-.}${2:-.}${3:-.}" in
>       orig=$(unpack-file $1)
>       src1=$(unpack-file $2)
>       src2=$(unpack-file $3)
> -     merge "$src2" "$orig" "$src1" || echo Leaving conflict merge in $src2 
> && exit 1
> +     merge "$src2" "$orig" "$src1" || (echo Leaving conflict merge in $src2 
> && exit 1)
>       cp "$src2" "$4" && update-cache --add -- "$4" && exit 0

What's the right way?

Maybe

        if merge "$src2" "$orig" "$src1"
        then 
                cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
        fi
        echo Leaving conflict merge in $src2
        exit 1

would work?

                Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to