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

Re: [PATCH 3/7] update-index: use unmerge_index_entry() to support removal

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 31, 2023, 23:14 UTC
Message-ID
<xmqqleev3c8x.fsf@gitster.g>
In-Reply-To
<20230731224409.4181277-4-gitster@pobox.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 9 quoted lines
> @@ -122,6 +128,8 @@ test_expect_success 'add records checkout -m undoes' '
>  test_expect_success 'unmerge with plumbing' '
>  	prime_resolve_undo &&
>  	git update-index --unresolve fi/le &&
> +	git ls-files --resolve-undo fi/le >actual &&
> +	test_must_be_empty actual &&
>  	git ls-files -u >actual &&
>  	test_line_count = 3 actual
>  '

This addition, and matching invocations of "ls-files --resolve-undo" in the next tests, are not explained in the proposed log message.

The reason for the addition is because "update-index --unresolve" tests did not make sure that resolve-undo records that are used to recreate conflicted states are removed from the index, like simiar tests for "checkout --merge". As we are changing the implementation to unmerge index entries, we do not want to regress and these are filling the gap of the test coverage.

I've clarified it in the draft for the next iteration.
	Side note: careful audience may have noticed this already,
	but yes, this is setting an example of the recent update to
	"my patch was sent, now what?" document, where we discourage
	sending rerolls without giving readers enough time to digest
	the first iteration, and instead tell them to note what will
	change in their next iteration.
Show 28 quoted lines
> @@ -130,6 +138,27 @@ test_expect_success 'unmerge can be done even after committing' '
>  	prime_resolve_undo &&
>  	git commit -m "record to nuke MERGE_HEAD" &&
>  	git update-index --unresolve fi/le &&
> +	git ls-files --resolve-undo fi/le >actual &&
> +	test_must_be_empty actual &&
> +	git ls-files -u >actual &&
> +	test_line_count = 3 actual
> +'
> +
> +test_expect_success 'unmerge removal' '
> +	prime_resolve_undo remove &&
> +	git update-index --unresolve fi/le &&
> +	git ls-files --resolve-undo fi/le >actual &&
> +	test_must_be_empty actual &&
> +	git ls-files -u >actual &&
> +	test_line_count = 3 actual
> +'
> +
> +test_expect_success 'unmerge removal after committing' '
> +	prime_resolve_undo remove &&
> +	git commit -m "record to nuke MERGE_HEAD" &&
> +	git update-index --unresolve fi/le &&
> +	git ls-files --resolve-undo fi/le >actual &&
> +	test_must_be_empty actual &&
>  	git ls-files -u >actual &&
>  	test_line_count = 3 actual
>  '
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 10 in “unresolve removal”
  1. 0/7 unresolve removalJunio C Hamano, Jul 31, 2023
  2. 3/7 update-index: use unmerge_index_entry() to support removalJunio C Hamano, Jul 31, 2023
  3. Junio C HamanoJul 31, 2023
  4. 2/7 resolve-undo: allow resurrecting conflicted state that resolved to deletionJunio C Hamano, Jul 31, 2023
  5. 4/7 update-index: remove stale fallback code for "--unresolve"Junio C Hamano, Jul 31, 2023
  6. 6/7 checkout/restore: add basic tests for --mergeJunio C Hamano, Jul 31, 2023
  7. 7/7 checkout: allow "checkout -m path" to unmerge removed pathsJunio C Hamano, Jul 31, 2023
  8. 1/7 update-index: do not read HEAD and MERGE_HEAD unconditionallyJunio C Hamano, Jul 31, 2023
  9. 5/7 checkout/restore: refuse unmerging paths unless checking out of the indexJunio C Hamano, Jul 31, 2023
  10. Taylor BlauAug 4, 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.