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

[PATCH 6/8] t/t5333-pseudo-merge-bitmaps.sh: demonstrate empty pseudo-merge groups

From
Taylor Blau <me@ttaylorr.com>
Date
Aug 15, 2024, 17:31 UTC
Message-ID
<228553e412fc3020a6f24eea601c47a08d70a2bf.1723743050.git.me@ttaylorr.com>
In-Reply-To
<cover.1723743050.git.me@ttaylorr.com>

Demonstrate that it is possible to generate empty pseudo-merge commits in certain cases.

In the below instance, we generate one non-empty pseudo-merge (containing commit "base"), and one empty pseudo-merge group (corresponding to the unstable commits within that group).

(In my testing, the pseudo-merge machinery seems to handle empty groups just fine, but generating them is pointless as they carry no information.)

This commit (introducing a deliberate "test_expect_failure") is split out from the actual fix (which will appear in the following commit) to demonstrate that the failure is correctly induced.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/t5333-pseudo-merge-bitmaps.sh | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh
index f052f395a7..0288691340 100755
--- a/t/t5333-pseudo-merge-bitmaps.sh
+++ b/t/t5333-pseudo-merge-bitmaps.sh
@@ -390,4 +390,24 @@ test_expect_success 'pseudo-merge reuse' '
 	)
 '
 
+test_expect_failure 'empty pseudo-merge group' '
+	git init pseudo-merge-empty-group &&
+	(
+		cd pseudo-merge-empty-group &&
+
+		# Ensure that a pseudo-merge group with no unstable
+		# commits does not generate an empty pseudo-merge
+		# bitmap.
+		git config bitmapPseudoMerge.empty.pattern refs/ &&
+
+		test_commit base &&
+		git repack -adb &&
+
+		test-tool bitmap dump-pseudo-merges >merges &&
+		test_line_count = 1 merges &&
+
+		test 0 -eq "$(grep -c commits=0 <merges)"
+	)
+'
+
 test_done
-- 
2.46.0.54.gc9a64b1d2a
Previous: Taylor BlauNext: Taylor Blau
Message 13 of 20 in “pseudo-merge: avoid empty and non-closed pseudo-merge commits”
  1. 0/8 pseudo-merge: avoid empty and non-closed pseudo-merge commitsTaylor Blau, Aug 15, 2024
  2. 1/8 pack-bitmap: initialize `bitmap_writer_init()` with packing_dataTaylor Blau, Aug 15, 2024
  3. Jeff KingAug 17, 2024
  4. Taylor BlauAug 29, 2024
  5. Jeff KingAug 29, 2024
  6. 2/8 pack-bitmap: drop redundant args from `bitmap_writer_build_type_index()`Taylor Blau, Aug 15, 2024
  7. 3/8 pack-bitmap: drop redundant args from `bitmap_writer_build()`Taylor Blau, Aug 15, 2024
  8. 4/8 pack-bitmap: drop redundant args from `bitmap_writer_finish()`Taylor Blau, Aug 15, 2024
  9. 5/8 pack-bitmap-write.c: select pseudo-merges even for small bitmapsTaylor Blau, Aug 15, 2024
  10. Jeff KingAug 17, 2024
  11. Junio C HamanoAug 17, 2024
  12. Taylor BlauAug 29, 2024
  13. 6/8 t/t5333-pseudo-merge-bitmaps.sh: demonstrate empty pseudo-merge groupsTaylor Blau, Aug 15, 2024
  14. 7/8 pseudo-merge.c: do not generate empty pseudo-merge commitsTaylor Blau, Aug 15, 2024
  15. Jeff KingAug 17, 2024
  16. Taylor BlauAug 29, 2024
  17. 8/8 pseudo-merge.c: ensure pseudo-merge groups are closedTaylor Blau, Aug 15, 2024
  18. Jeff KingAug 17, 2024
  19. Jeff KingAug 17, 2024
  20. Taylor BlauAug 29, 2024

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.