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

[PATCH] Tests: read-tree -m test updates.

From
Junio C Hamano <junkio@cox.net>
Date
Jun 8, 2005, 09:08 UTC
Message-ID
<7vwtp5b4gp.fsf_-_@assigned-by-dhcp.cox.net>
In-Reply-To
<7v7jh5ct1b.fsf@assigned-by-dhcp.cox.net>

This updates t1000 (basic 3-way merge test) to check the merge results for both successful cases (earlier one checked the result for only one of them). Also fixes typos in t1002 that broke '&&' chain, potentially missing a test failure before the chain got broken.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 t/t1000-read-tree-m-3way.sh   |   58 ++++++++++++++++++++---------------------
 t/t1002-read-tree-m-u-2way.sh |    4 +--
 2 files changed, 30 insertions(+), 32 deletions(-)
diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh
--- a/t/t1000-read-tree-m-3way.sh
+++ b/t/t1000-read-tree-m-3way.sh
@@ -77,34 +77,6 @@ In addition:
 ################################################################
 # Try merging and showing the various diffs
 
-# The tree is dirty at this point.
-test_expect_failure \
-    '3-way merge with git-read-tree -m' \
-    "git-read-tree -m $tree_O $tree_A $tree_B"
-
-# This is done on an empty work directory, which is the normal
-# merge person behaviour.
-test_expect_success \
-    '3-way merge with git-read-tree -m' \
-    "rm -fr [NDMALTS][NDMALTSF] Z &&
-     rm .git/index &&
-     git-read-tree -m $tree_O $tree_A $tree_B"
-
-# This starts out with the first head, which is the normal
-# patch submitter behaviour.
-test_expect_success \
-    '3-way merge with git-read-tree -m' \
-    "git-read-tree $tree_A &&
-     git-checkout-cache -f -u -a &&
-     git-read-tree -m $tree_O $tree_A $tree_B"
-
-_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
-_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
-test_expect_success \
-    'git-ls-files --stage of the merge result' \
-    'git-ls-files --stage >current- &&
-     sed -e "s/ $_x40 / X /" <current- >current'
-
 cat >expected <<\EOF
 100644 X 2	AA
 100644 X 3	AA
@@ -154,8 +126,34 @@ cat >expected <<\EOF
 100644 X 0	Z/NN
 EOF
 
+_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
+_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
+
+# The tree is dirty at this point.
+test_expect_failure \
+    '3-way merge with git-read-tree -m, dirty cache' \
+    "git-read-tree -m $tree_O $tree_A $tree_B"
+
+# This is done on an empty work directory, which is the normal
+# merge person behaviour.
+test_expect_success \
+    '3-way merge with git-read-tree -m, empty cache' \
+    "rm -fr [NDMALTS][NDMALTSF] Z &&
+     rm .git/index &&
+     git-read-tree -m $tree_O $tree_A $tree_B &&
+     git-ls-files --stage |
+     sed -e 's/ $_x40 / X /' >current &&
+     diff -u expected current"
+
+# This starts out with the first head, which is the normal
+# patch submitter behaviour.
 test_expect_success \
-    'validate merge result' \
-    'diff current expected'
+    '3-way merge with git-read-tree -m, match H' \
+    "git-read-tree $tree_A &&
+     git-checkout-cache -f -u -a &&
+     git-read-tree -m $tree_O $tree_A $tree_B &&
+     git-ls-files --stage |
+     sed -e 's/ $_x40 / X /' >current &&
+     diff -u expected current"
 
 test_done
diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh
--- a/t/t1002-read-tree-m-u-2way.sh
+++ b/t/t1002-read-tree-m-u-2way.sh
@@ -93,7 +93,7 @@ test_expect_success \
      compare_change 5diff.out expected &&
      check_cache_at yomin dirty &&
      sha1sum -c M.sha1 &&
-     : dirty index should have prevented -u from checking it out.
+     : dirty index should have prevented -u from checking it out. &&
      echo yomin yomin >yomin1 &&
      diff yomin yomin1 &&
      rm -f yomin1'
@@ -122,7 +122,7 @@ test_expect_success \
      diff --unified=0 M.out 7.out &&
      check_cache_at frotz dirty &&
      if sha1sum -c M.sha1; then false; else :; fi &&
-     : dirty index should have prevented -u from checking it out.
+     : dirty index should have prevented -u from checking it out. &&
      echo frotz frotz >frotz1 &&
      diff frotz frotz1 &&
      rm -f frotz1'
------------
Previous: Junio C Hamano
Message 25 of 25 in “Documentation: describe git extended diff headers.”
  1. Documentation: describe git extended diff headers.Junio C Hamano, Jun 5, 2005
  2. Linus TorvaldsJun 5, 2005
  3. Fix diff.c to match rename extended header to the document.Junio C Hamano, Jun 5, 2005
  4. Fix apply.c to match rename extended header to the document.Junio C Hamano, Jun 5, 2005
  5. Linus TorvaldsJun 5, 2005
  6. Last mile for 1.0Junio C Hamano, Jun 5, 2005
  7. Junio C HamanoJun 5, 2005
  8. McMullan, JasonJun 6, 2005
  9. Linus TorvaldsJun 6, 2005
  10. git-whatchanged vs "cvs annotate"Junio C Hamano, Jun 6, 2005
  11. Thomas GlanzmannJun 6, 2005
  12. Linus TorvaldsJun 6, 2005
  13. Junio C HamanoJun 6, 2005
  14. Linus TorvaldsJun 6, 2005
  15. Thomas GlanzmannJun 6, 2005
  16. Linus TorvaldsJun 6, 2005
  17. Thomas GlanzmannJun 6, 2005
  18. Junio C HamanoJun 6, 2005
  19. Linus TorvaldsJun 6, 2005
  20. Junio C HamanoJun 6, 2005
  21. Linus TorvaldsJun 6, 2005
  22. Linus TorvaldsJun 6, 2005
  23. 3-way read-tree case matrix.Junio C Hamano, Jun 8, 2005
  24. Junio C HamanoJun 8, 2005
  25. Tests: read-tree -m test updates.Junio C Hamano, Jun 8, 2005

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.