Re: [PATCH v3 1/3] Demonstrate a bug in --word-diff where diff.*.wordregex is "sticky"

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v3 1/3] Demonstrate a bug in --word-diff where diff.*.wordregex is "sticky"

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:18

Johannes Sixt [off-list ref] writes:
The test case applies a custom wordRegex to one file in a diff, and expects
that the default word splitting applies to the second file in the diff.
But the custom wordRegex is also incorrectly used for the second file.

Helped-by: Thomas Rast [off-list ref]
Signed-off-by: Johannes Sixt <redacted>
---
Changes in this round, where I do not resend 2/3 and 3/3:

- Use test_unconfig.
- Use compare_diff_patch to check the result.
- Fix a broken && chain at the end of the last test.
- Name the files a.tex and z.tex as per your suggestion.
Thanks, but using a.tex and z.tex and marking only the former as tex
does not change anything in the puzzlement I mentioned in my response.

Perhaps this on top of your patch?

 t/t4034-diff-words.sh |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index 9e9643e..310ace1 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -355,18 +355,18 @@ test_expect_success 'word-diff with no newline at EOF' '
 
 test_expect_success 'setup history with two files' '
 	echo "a b; c" >a.tex &&
-	echo "a b; c" >z.tex &&
-	git add a.tex z.tex &&
+	echo "a b; c" >z.txt &&
+	git add a.tex z.txt &&
 	git commit -minitial &&
 
 	# modify both
 	echo "a bx; c" >a.tex &&
-	echo "a bx; c" >z.tex &&
+	echo "a bx; c" >z.txt &&
 	git commit -mmodified -a
 '
 
 test_expect_failure 'wordRegex for the first file does not apply to the second' '
-	echo "a.tex diff=tex" >.gitattributes &&
+	echo "*.tex diff=tex" >.gitattributes &&
 	git config diff.tex.wordRegex "[a-z]+|." &&
 	cat >expect <<-\EOF &&
 		diff --git a/a.tex b/a.tex
@@ -374,9 +374,9 @@ test_expect_failure 'wordRegex for the first file does not apply to the second'
 		+++ b/a.tex
 		@@ -1 +1 @@
 		a [-b-]{+bx+}; c
-		diff --git a/z.tex b/z.tex
-		--- a/z.tex
-		+++ b/z.tex
+		diff --git a/z.txt b/z.txt
+		--- a/z.txt
+		+++ b/z.txt
 		@@ -1 +1 @@
 		a [-b;-]{+bx;+} c
 	EOF
-- 
1.7.10.rc0.65.g3445e

Re: [PATCH v3 1/3] Demonstrate a bug in --word-diff where diff.*.wordregex is "sticky"

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:53:18

Am 14.03.2012 22:38, schrieb Junio C Hamano:
Thanks, but using a.tex and z.tex and marking only the former as tex
does not change anything in the puzzlement I mentioned in my response.
Oh, I see. I didn't notice this detail. Please squash in your proposed
fixup that uses z.txt.

Thanks,
-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help