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

Re: [PATCH 3/3] checkout -m: attempt merge when deletion of path was staged

From
Johannes Sixt <j6t@kdbg.org>
Date
Aug 13, 2014, 19:30 UTC
Message-ID
<53EBBCC3.4060309@kdbg.org>
In-Reply-To
<xmqqvbpw2p2x.fsf@gitster.dls.corp.google.com>
Am 13.08.2014 20:59, schrieb Junio C Hamano:
Show 18 quoted lines
> diff --git a/t/t7201-co.sh b/t/t7201-co.sh
> index 0c9ec0a..cedbb6a 100755
> --- a/t/t7201-co.sh
> +++ b/t/t7201-co.sh
> @@ -223,6 +223,23 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
>  	test_cmp two expect
>  '
>  
> +test_expect_success 'switch to another branch while carrying a deletion' '
> +
> +	git checkout -f master && git reset --hard && git clean -f &&
> +	git rm two &&
> +
> +	test_must_fail git checkout simple 2>errs &&
> +	test_i18ngrep overwritten errs &&
> +
> +	git checkout --merge simple 2>errs &&
> +	! test_i18ngrep overwritten errs &&
This must be written as
	test_i18ngrep ! overwritten errs &&
Show 11 quoted lines
> +	git ls-files -u &&
> +	test_must_fail git cat-file -t :0:two &&
> +	test "$(git cat-file -t :1:two)" = blob &&
> +	test "$(git cat-file -t :2:two)" = blob &&
> +	test_must_fail git cat-file -t :3:two
> +'
> +
>  test_expect_success 'checkout to detach HEAD (with advice declined)' '
>  
>  	git config advice.detachedHead false &&
> 
I see a few wrong usages in the current code base. Here's a fix.
--- >8 ---
Subject: [PATCH] tests: fix negated test_i18ngrep calls

The helper function test_i18ngrep pretends that it found the expected results when it is running under GETTEXT_POISON. For this reason, it must not be used negated like so

   ! test_i18ngrep foo bar

because the test case would fail under GETTEXT_POISON. The function offers a special syntax to test that a pattern is *not* found:

   test_i18ngrep ! foo bar
Convert incorrect uses to this syntax.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/t4018-diff-funcname.sh | 8 ++++----
 t/t9800-git-p4-basic.sh  | 2 +-
 t/t9807-git-p4-submit.sh | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 34591c2..1dbaa38 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -52,15 +52,15 @@ do
 		echo "*.java diff=$p" >.gitattributes &&
 		test_expect_code 1 git diff --no-index \
 			A.java B.java 2>msg &&
-		! test_i18ngrep fatal msg &&
-		! test_i18ngrep error msg
+		test_i18ngrep ! fatal msg &&
+		test_i18ngrep ! error msg
 	'
 	test_expect_success "builtin $p wordRegex pattern compiles" '
 		echo "*.java diff=$p" >.gitattributes &&
 		test_expect_code 1 git diff --no-index --word-diff \
 			A.java B.java 2>msg &&
-		! test_i18ngrep fatal msg &&
-		! test_i18ngrep error msg
+		test_i18ngrep ! fatal msg &&
+		test_i18ngrep ! error msg
 	'
 done
 
diff --git a/t/t9800-git-p4-basic.sh b/t/t9800-git-p4-basic.sh
index 665607c..5b56212 100755
--- a/t/t9800-git-p4-basic.sh
+++ b/t/t9800-git-p4-basic.sh
@@ -145,7 +145,7 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
 		test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1
 	) &&
 	cat errs &&
-	! test_i18ngrep Traceback errs
+	test_i18ngrep ! Traceback errs
 '
 
 # Hide a file from p4d, make sure we catch its complaint.  This won't fail in
diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
index 7fab2ed..1f74a88 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -404,7 +404,7 @@ test_expect_success 'submit --prepare-p4-only' '
 		git p4 submit --prepare-p4-only >out &&
 		test_i18ngrep "prepared for submission" out &&
 		test_i18ngrep "must be deleted" out &&
-		! test_i18ngrep "everything below this line is just the diff" out
+		test_i18ngrep ! "everything below this line is just the diff" out
 	) &&
 	(
 		cd "$cli" &&
-- 
2.0.0.12.gbcf935e
Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 15 in “unpack-tree.c: remove dead code”
  1. unpack-tree.c: remove dead codeStefan Beller, Aug 11, 2014
  2. Junio C HamanoAug 12, 2014
  3. unpack-tree.c: remove dead codeStefan Beller, Aug 12, 2014
  4. Junio C HamanoAug 12, 2014
  5. 0/3 Re: [PATCH] unpack-tree.c: remove dead codeJonathan Nieder, Aug 12, 2014
  6. 1/3 unpack-trees: simplify 'all other failures' caseJonathan Nieder, Aug 12, 2014
  7. 2/3 unpack-trees: use 'cuddled' style for if-else cascadeJonathan Nieder, Aug 13, 2014
  8. Ronnie SahlbergAug 13, 2014
  9. 3/3 checkout -m: attempt merge when deletion of path was stagedJonathan Nieder, Aug 13, 2014
  10. Junio C HamanoAug 13, 2014
  11. Junio C HamanoAug 13, 2014
  12. Junio C HamanoAug 13, 2014
  13. Johannes SixtAug 13, 2014
  14. Junio C HamanoAug 13, 2014
  15. Stefan BellerAug 13, 2014

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.