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

[PATCH 2/3] t4150-am: refactor am -3 tests

From
Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Date
May 26, 2015, 21:32 UTC
Message-ID
<1432675975-11020-2-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr>
In-Reply-To
<1432675975-11020-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr>

Move the creation of the file, commit and branch used in git am -3 tests in a setup test, to avoid creating this setup several time.

Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
 t/t4150-am.sh | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 8370951..8f85098 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -272,13 +272,17 @@ test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
 	grep "^\[foo\] third" actual
 '
 
+test_expect_success 'setup: am -3' '
+	setup_fixed_branch lorem2 master2 &&
+	sed -n -e "3,\$p" msg >file &&
+	head -n 9 msg >>file &&
+	git add file &&
+	test_tick &&
+	git commit -m "copied stuff"
+'
+
 test_expect_success 'am -3 falls back to 3-way merge' '
+	setup_temporary_branch lorem2 &&
-	setup_fixed_branch lorem2 master2 &&
-	sed -n -e "3,\$p" msg >file &&
-	head -n 9 msg >>file &&
-	git add file &&
-	test_tick &&
-	git commit -m "copied stuff" &&
 	git am -3 lorem-move.patch &&
 	test_path_is_missing .git/rebase-apply &&
 	git diff --exit-code lorem
@@ -286,11 +290,6 @@ test_expect_success 'am -3 falls back to 3-way merge' '
 
 test_expect_success 'am -3 -p0 can read --no-prefix patch' '
 	setup_temporary_branch lorem2 &&
-	sed -n -e "3,\$p" msg >file &&
-	head -n 9 msg >>file &&
-	git add file &&
-	test_tick &&
-	git commit -m "copied stuff" &&
 	git am -3 -p0 lorem-zero.patch &&
 	test_path_is_missing .git/rebase-apply &&
 	git diff --exit-code lorem
@@ -325,11 +324,6 @@ test_expect_success 'am -3 can rename a file after falling back to 3-way merge'
 
 test_expect_success 'am -3 -q is quiet' '
 	setup_temporary_branch lorem2 &&
-	sed -n -e "3,\$p" msg >file &&
-	head -n 9 msg >>file &&
-	git add file &&
-	test_tick &&
-	git commit -m "copied stuff" &&
 	git am -3 -q lorem-move.patch >output.out 2>&1 &&
 	! test -s output.out
 '
-- 
1.9.1
Previous: Remi LespinetNext: Remi Lespinet
Message 2 of 11 in “t4150-am: refactor and clean common setup”
  1. 1/3 t4150-am: refactor and clean common setupRemi Lespinet, May 26, 2015
  2. 2/3 t4150-am: refactor am -3 testsRemi Lespinet, May 26, 2015
  3. 3/3 git-am: add am.threeWay config variableRemi Lespinet, May 26, 2015
  4. Paul TanMay 28, 2015
  5. Junio C HamanoMay 28, 2015
  6. Matthieu MoyMay 28, 2015
  7. Paul TanMay 28, 2015
  8. Eric SunshineMay 28, 2015
  9. 1/3 t4150-am: refactor and clean common setupRemi LESPINET, May 29, 2015
  10. Eric SunshineMay 28, 2015
  11. Eric SunshineMay 28, 2015

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.