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

Re: [PATCH v2 1/2] t5574: test porcelain output of atomic fetch

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 15, 2023, 09:56 UTC
Message-ID
<ZXwi2MA-KUxszfGj@tanuki>
In-Reply-To
<210191917bcfa9293622908c291652059576f3e5.1702556642.git.zhiyou.jx@alibaba-inc.com>
On Thu, Dec 14, 2023 at 08:33:11PM +0800, Jiang Xin wrote:
> From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
[snip]
Show 45 quoted lines
> @@ -91,36 +85,61 @@ test_expect_success 'fetch porcelain output' '
>  	git checkout force-updated &&
>  	git reset --hard HEAD~ &&
>  	test_commit --no-tag force-update-new &&
> -	FORCE_UPDATED_NEW=$(git rev-parse HEAD) &&
> -
> -	cat >expect <<-EOF &&
> -	- $MAIN_OLD $ZERO_OID refs/forced/deleted-branch
> -	- $MAIN_OLD $ZERO_OID refs/unforced/deleted-branch
> -	  $MAIN_OLD $FAST_FORWARD_NEW refs/unforced/fast-forward
> -	! $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/unforced/force-updated
> -	* $ZERO_OID $MAIN_OLD refs/unforced/new-branch
> -	  $MAIN_OLD $FAST_FORWARD_NEW refs/forced/fast-forward
> -	+ $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/forced/force-updated
> -	* $ZERO_OID $MAIN_OLD refs/forced/new-branch
> -	  $MAIN_OLD $FAST_FORWARD_NEW refs/remotes/origin/fast-forward
> -	+ $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/remotes/origin/force-updated
> -	* $ZERO_OID $MAIN_OLD refs/remotes/origin/new-branch
> -	EOF
> -
> -	# Execute a dry-run fetch first. We do this to assert that the dry-run
> -	# and non-dry-run fetches produces the same output. Execution of the
> -	# fetch is expected to fail as we have a rejected reference update.
> -	test_must_fail git -C porcelain fetch \
> -		--porcelain --dry-run --prune origin $refspecs >actual &&
> -	test_cmp expect actual &&
> -
> -	# And now we perform a non-dry-run fetch.
> -	test_must_fail git -C porcelain fetch \
> -		--porcelain --prune origin $refspecs >actual 2>stderr &&
> -	test_cmp expect actual &&
> -	test_must_be_empty stderr
> +	FORCE_UPDATED_NEW=$(git rev-parse HEAD)
>  '
>  
> +for opt in off on
> +do
> +	case $opt in
> +	on)
> +		opt=--atomic
> +		;;
> +	off)
> +		opt=
> +		;;
> +	esac
Nit: you could also do `for opt in "--atomic" ""` directly to get rid of
this case statement. Not sure whether this is worth a reroll though,
probably not.
Patrick
Previous: Jiang XinNext: Jiang Xin
Message 11 of 19 in “t5574: test porcelain output of atomic fetch”
  1. 1/2 t5574: test porcelain output of atomic fetchJiang Xin, Oct 19, 2023
  2. 2/2 fetch: no redundant error message for atomic fetchJiang Xin, Oct 19, 2023
  3. Patrick SteinhardtOct 23, 2023
  4. Jiang XinOct 23, 2023
  5. Patrick SteinhardtOct 23, 2023
  6. Jiang XinOct 23, 2023
  7. Patrick SteinhardtOct 25, 2023
  8. Junio C HamanoOct 24, 2023
  9. 0/2 jx/fetch-atomic-error-message-fixJiang Xin, Dec 14, 2023
  10. 1/2 t5574: test porcelain output of atomic fetchJiang Xin, Dec 14, 2023
  11. Patrick SteinhardtDec 15, 2023
  12. Jiang XinDec 15, 2023
  13. Junio C HamanoDec 15, 2023
  14. 2/2 fetch: no redundant error message for atomic fetchJiang Xin, Dec 14, 2023
  15. Patrick SteinhardtDec 15, 2023
  16. 0/2 fix fetch atomic error messageJiang Xin, Dec 17, 2023
  17. 1/2 t5574: test porcelain output of atomic fetchJiang Xin, Dec 17, 2023
  18. 2/2 fetch: no redundant error message for atomic fetchJiang Xin, Dec 17, 2023
  19. Patrick SteinhardtDec 18, 2023

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.