Subject: Re: [PATCH v2 5/6] push: only ignore finish_connect() for dry-run mode

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 25 Nov 2024 09:26:33 +0100

On Fri, Nov 15, 2024 at 01:15:36AM +0800, Jiang Xin wrote:
> diff --git a/transport.c b/transport.c
> index 9e03a7148c..186d58e907 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -923,10 +923,10 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
>  	close(data->fd[0]);
>  	/*
>  	 * Atomic push may abort the connection early and close the pipe,
> -	 * which may cause an error for `finish_connect()`. Ignore this error
> -	 * for atomic git-push.
> +	 * which may cause an error for `finish_connect()`. We can ignore
> +	 * this error when both `--atomic` and `--dry-run` flags provided.
>  	 */
> -	if (ret || args.atomic)
> +	if (ret || (args.atomic && args.dry_run))
>  		finish_connect(data->conn);
>  	else
>  		ret = finish_connect(data->conn);

In the same spirit as mentioned in other commits I don't think it is a
good idea to condition this behaviour on "--dry-run".

Patrick