git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 2/2] transport-helper: check if remote helper is alive

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 7, 2013, 17:49 UTC
Message-ID
<7vwqse2pu0.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1365320706-13539-3-git-send-email-felipe.contreras@gmail.com>
Felipe Contreras <felipe.contreras@gmail.com> writes:
> Otherwise transport-helper will continue checking for refs and other
> things what will confuse the user more.
> ---
Sign-off?
Show 17 quoted lines
>  git-remote-testgit        | 11 +++++++++++
>  t/t5801-remote-helpers.sh | 19 +++++++++++++++++++
>  transport-helper.c        |  8 ++++++++
>  3 files changed, 38 insertions(+)
>
> diff --git a/git-remote-testgit b/git-remote-testgit
> index b395c8d..ca0cf09 100755
> --- a/git-remote-testgit
> +++ b/git-remote-testgit
> @@ -61,12 +61,23 @@ do
>  			echo "feature import-marks=$gitmarks"
>  			echo "feature export-marks=$gitmarks"
>  		fi
> +
> +		if test -n "$GIT_REMOTE_TESTGIT_FAILURE"
> +		then
> +			exit -1

It is rather unusual to see a negative return value returned from a shell script. Shouldn't this be something like 127 (or 1)?

Show 54 quoted lines
> diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
> index f387027..efe67e2 100755
> --- a/t/t5801-remote-helpers.sh
> +++ b/t/t5801-remote-helpers.sh
> @@ -166,4 +166,23 @@ test_expect_success 'push ref with existing object' '
>  	compare_refs local dup server dup
>  '
>  
> +test_expect_success 'proper failure checks for fetching' '
> +	(GIT_REMOTE_TESTGIT_FAILURE=1 &&
> +	export GIT_REMOTE_TESTGIT_FAILURE &&
> +	cd local &&
> +	test_must_fail git fetch 2> error &&
> +	grep "Error while running helper" error
> +	)
> +'
> +
> +# We sleep to give fast-export a chance to catch the SIGPIPE
> +test_expect_failure 'proper failure checks for pushing' '
> +	(GIT_REMOTE_TESTGIT_FAILURE=1 &&
> +	export GIT_REMOTE_TESTGIT_FAILURE &&
> +	cd local &&
> +	test_must_fail git push --all 2> error &&
> +	grep "Error while running helper" error
> +	)
> +'
> +
>  test_done
> diff --git a/transport-helper.c b/transport-helper.c
> index cb3ef7d..dfdfa7a 100644
> --- a/transport-helper.c
> +++ b/transport-helper.c
> @@ -460,6 +460,10 @@ static int fetch_with_import(struct transport *transport,
>  
>  	if (finish_command(&fastimport))
>  		die("Error while running fast-import");
> +
> +	if (!check_command(data->helper))
> +		die("Error while running helper");
> +
>  	argv_array_free_detached(fastimport.argv);
>  
>  	/*
> @@ -818,6 +822,10 @@ static int push_refs_with_export(struct transport *transport,
>  
>  	if (finish_command(&exporter))
>  		die("Error while running fast-export");
> +
> +	if (!check_command(data->helper))
> +		die("Error while running helper");
> +
>  	push_update_refs_status(data, remote_refs);
>  	return 0;
>  }
Previous: Felipe ContrerasNext: Jeff King
Message 6 of 19 in “run-command: new check_command helper”
  1. 0/2 run-command: new check_command helperFelipe Contreras, Apr 7, 2013
  2. 1/2 run-command: add new check_command helperFelipe Contreras, Apr 7, 2013
  3. Junio C HamanoApr 7, 2013
  4. Junio C HamanoApr 7, 2013
  5. 2/2 transport-helper: check if remote helper is aliveFelipe Contreras, Apr 7, 2013
  6. Junio C HamanoApr 7, 2013
  7. Jeff KingApr 8, 2013
  8. Felipe ContrerasApr 8, 2013
  9. Jeff KingApr 8, 2013
  10. Felipe ContrerasApr 8, 2013
  11. Junio C HamanoApr 8, 2013
  12. Felipe ContrerasApr 8, 2013
  13. Junio C HamanoApr 8, 2013
  14. Felipe ContrerasApr 8, 2013
  15. Junio C HamanoApr 8, 2013
  16. Jeff KingApr 8, 2013
  17. Junio C HamanoApr 8, 2013
  18. Jeff KingApr 8, 2013
  19. Jeff KingApr 8, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.