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

[PATCH v17 3/7] bisect: add tests to document expected behaviour in presence of broken trees.

From
Jon Seymour <jon.seymour@gmail.com>
Date
Aug 4, 2011, 12:00 UTC
Message-ID
<1312459263-16911-4-git-send-email-jon.seymour@gmail.com>
In-Reply-To
<1312459263-16911-1-git-send-email-jon.seymour@gmail.com>
If the repo is broken, we expect bisect to fail.
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 t/t6030-bisect-porcelain.sh |   48 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index b3d1b14..9ae2de8 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -581,5 +581,53 @@ test_expect_success 'erroring out when using bad path parameters' '
 '
 
 #
+# This creates a broken branch which cannot be checked out because
+# the tree created has been deleted.
 #
+# H1-H2-H3-H4-H5-H6-H7  <--other
+#            \
+#             S5-S6'-S7'-S8'-S9  <--broken
+#
+# Commits marked with ' have a missing tree.
+#
+test_expect_success 'broken branch creation' '
+	git bisect reset &&
+	git checkout -b broken $HASH4 &&
+	git tag BROKEN_HASH4 $HASH4 &&
+	add_line_into_file "5(broken): first line on a broken branch" hello2 &&
+	git tag BROKEN_HASH5 &&
+	mkdir missing &&
+	:> missing/MISSING &&
+	git add missing/MISSING &&
+	git commit -m "6(broken): Added file that will be deleted"
+	git tag BROKEN_HASH6 &&
+	add_line_into_file "7(broken): second line on a broken branch" hello2 &&
+	git tag BROKEN_HASH7 &&
+	add_line_into_file "8(broken): third line on a broken branch" hello2 &&
+	git tag BROKEN_HASH8 &&
+	git rm missing/MISSING &&
+	git commit -m "9(broken): Remove missing file"
+	git tag BROKEN_HASH9 &&
+	rm .git/objects/39/f7e61a724187ab767d2e08442d9b6b9dab587d
+'
+
+echo "" > expected.ok
+cat > expected.missing-tree.default <<EOF
+fatal: unable to read tree 39f7e61a724187ab767d2e08442d9b6b9dab587d
+EOF
+
+test_expect_success 'bisect fails if tree is broken on start commit' '
+	git bisect reset &&
+	test_must_fail git bisect start BROKEN_HASH7 BROKEN_HASH4 2>error.txt &&
+	test_cmp expected.missing-tree.default error.txt
+'
+
+test_expect_success 'bisect fails if tree is broken on trial commit' '
+	git bisect reset &&
+	test_must_fail git bisect start BROKEN_HASH9 BROKEN_HASH4 2>error.txt &&
+	git reset --hard broken &&
+	git checkout broken &&
+	test_cmp expected.missing-tree.default error.txt
+'
+
 test_done
-- 
1.7.6.353.g50d6f
Previous: Jon SeymourNext: Jon Seymour
Message 8 of 12 in “bisect: Add support for --no-checkout option”
  1. 0/7 bisect: Add support for --no-checkout optionJon Seymour, Aug 4, 2011
  2. 1/7 bisect: move argument parsing before state modification.Jon Seymour, Aug 4, 2011
  3. Christian CouderSep 7, 2011
  4. Junio C HamanoSep 7, 2011
  5. Johannes SixtSep 7, 2011
  6. Jon SeymourSep 8, 2011
  7. 2/7 bisect: use && to connect statements that are deferred with eval.Jon Seymour, Aug 4, 2011
  8. 3/7 bisect: add tests to document expected behaviour in presence of broken trees.Jon Seymour, Aug 4, 2011
  9. 4/7 bisect: introduce support for --no-checkout option.Jon Seymour, Aug 4, 2011
  10. 5/7 bisect: introduce --no-checkout support into porcelain.Jon Seymour, Aug 4, 2011
  11. 6/7 bisect: add tests for the --no-checkout option.Jon Seymour, Aug 4, 2011
  12. 7/7 bisect: add documentation for --no-checkout option.Jon Seymour, Aug 4, 2011

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.