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

[PATCH maint 1/2] t4018-diff-funcname: rework negated last expression test

From
drafnel@gmail.com <drafnel@gmail.com>
Date
Oct 16, 2008, 00:58 UTC
Message-ID
<13723998.1224118688113.JavaMail.teamon@b307.teamon.com>
In-Reply-To
<7vljwpr6lr.fsf@gitster.siamese.dyndns.org>

This test used the non-zero exit status of 'git diff' to indicate that a negated funcname pattern, when placed last, was correctly rejected.

The problem with this is that 'git diff' always returns non-zero if it finds differences in the files it is comparing, and the files must contain differences in order to trigger the funcname pattern codepath.

Instead of checking for non-zero exit status, make sure the expected error message is printed.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---

This is not really a series, but I expect you'll apply both, so this seems easier for both of us.

-brandon
 t/t4018-diff-funcname.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 99fff97..72076ec 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -65,7 +65,8 @@ test_expect_success 'custom pattern' '
 
 test_expect_success 'last regexp must not be negated' '
 	git config diff.java.funcname "!static" &&
-	test_must_fail git diff --no-index Beer.java Beer-correct.java
+	git diff --no-index Beer.java Beer-correct.java 2>&1 |
+	grep "fatal: Last expression must not be negated:"
 '
 
 test_expect_success 'alternation in pattern' '
-- 
1.6.0.2.101.gb844
Previous: Shawn O. PearceNext: Jeff King
Message 8 of 16 in “What's in git.git (Oct 2008, #03; Tue, 14)”
  1. Junio C HamanoOct 14, 2008
  2. Brandon CaseyOct 15, 2008
  3. Mike RalphsonOct 15, 2008
  4. Junio C HamanoOct 15, 2008
  5. Shawn O. PearceOct 15, 2008
  6. Junio C HamanoOct 15, 2008
  7. Shawn O. PearceOct 15, 2008
  8. 1/2 t4018-diff-funcname: rework negated last expression testdrafnel@gmail.com, Oct 16, 2008
  9. Jeff KingOct 16, 2008
  10. Brandon CaseyOct 16, 2008
  11. Pieter de BieOct 16, 2008
  12. Arjen LaarhovenOct 17, 2008
  13. Junio C HamanoOct 24, 2008
  14. Jeff KingOct 17, 2008
  15. Junio C HamanoOct 17, 2008
  16. 2/2 t4018-diff-funcname: demonstrate end of line funcname matching flawdrafnel@gmail.com, Oct 16, 2008

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.