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

Re: [PATCH 3/3] checkout: warn when unreachable commits after using --orphan

From
Andrei Rybak <rybak.a.v@gmail.com>
Date
Apr 27, 2023, 00:28 UTC
Message-ID
<033bd734-9c32-e5a2-3f5c-c851e4e3bc5d@gmail.com>
In-Reply-To
<417ae16c-9ba7-1e6d-c8d7-5b20a188b4fe@gmail.com>
On 23/04/2023 00:19, Rubén Justo wrote:
Show 16 quoted lines
> diff --git a/t/t2020-checkout-detach.sh b/t/t2020-checkout-detach.sh
> index 2eab6474f8..6762a9a572 100755
> --- a/t/t2020-checkout-detach.sh
> +++ b/t/t2020-checkout-detach.sh
> @@ -124,6 +124,15 @@ test_expect_success 'checkout warns on orphan commits: output' '
>   	check_orphan_warning stderr "2 commits"
>   '
>   
> +test_expect_success 'checkout --orphan warns on orphan commits' '
> +	git checkout "$orphan2" &&
> +	git checkout --orphan orphan 2>stderr
> +'
> +
> +test_expect_success 'checkout --orphan warns on orphan commits: output' '
> +	check_orphan_warning stderr "2 commits"
> +'
These two tests could be a single test.
	test_expect_success 'checkout --orphan warns on orphan commits' '
		git checkout "$orphan2" &&
		git checkout --orphan orphan 2>stderr &&
		check_orphan_warning stderr "2 commits"
	'

Validating output like this in a separate step is an artifact of the old way of checking localized strings. Tests were split into two in f06f08b78c ("i18n: mark checkout plural warning for translation", 2011-04-10) and then prerequisite C_LOCALE_OUTPUT was removed in f2c8c8007c ("i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200", 2011-04-12). Usage of test_i18ngrep was then removed in 1108cea7f8 ("tests: remove most uses of test_i18ncmp", 2021-02-11).

> +
>   test_expect_success 'checkout warns orphaning 1 of 2 commits' '
>   	git checkout "$orphan2" &&
>   	git checkout HEAD^ 2>stderr
Previous: Rubén JustoNext: Rubén Justo
Message 11 of 12 in “warn when unreachable commits are left behind”
  1. 0/3 warn when unreachable commits are left behindRubén Justo, Apr 22, 2023
  2. 1/3 checkout: move orphaned_commit_warning()Rubén Justo, Apr 22, 2023
  3. 2/3 worktree: warn when removing a worktree with orphan commitsRubén Justo, Apr 22, 2023
  4. Junio C HamanoApr 24, 2023
  5. Rubén JustoApr 26, 2023
  6. Junio C HamanoApr 27, 2023
  7. Eric SunshineApr 27, 2023
  8. Junio C HamanoApr 28, 2023
  9. Rubén JustoApr 27, 2023
  10. 3/3 checkout: warn when unreachable commits after using --orphanRubén Justo, Apr 22, 2023
  11. Andrei RybakApr 27, 2023
  12. Rubén JustoApr 27, 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.