about summary refs log tree commit diff
path: root/third_party/git/t/t4034-diff-words.sh
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T23·06+0100
commit93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch)
tree85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/t/t4034-diff-words.sh
parent6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff)
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable.

This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing
changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/t/t4034-diff-words.sh')
-rwxr-xr-xthird_party/git/t/t4034-diff-words.sh94
1 files changed, 39 insertions, 55 deletions
diff --git a/third_party/git/t/t4034-diff-words.sh b/third_party/git/t/t4034-diff-words.sh
index fb145aa173..912df91226 100755
--- a/third_party/git/t/t4034-diff-words.sh
+++ b/third_party/git/t/t4034-diff-words.sh
@@ -19,11 +19,9 @@ cat >post.simple <<-\EOF
 
 	aeff = aeff * ( aaa )
 EOF
-pre=$(git rev-parse --short $(git hash-object pre.simple))
-post=$(git rev-parse --short $(git hash-object post.simple))
-cat >expect.letter-runs-are-words <<-EOF
+cat >expect.letter-runs-are-words <<-\EOF
 	<BOLD>diff --git a/pre b/post<RESET>
-	<BOLD>index $pre..$post 100644<RESET>
+	<BOLD>index 330b04f..5ed8eff 100644<RESET>
 	<BOLD>--- a/pre<RESET>
 	<BOLD>+++ b/post<RESET>
 	<CYAN>@@ -1,3 +1,7 @@<RESET>
@@ -35,9 +33,9 @@ cat >expect.letter-runs-are-words <<-EOF
 
 	<GREEN>aeff = aeff * ( aaa<RESET> )
 EOF
-cat >expect.non-whitespace-is-word <<-EOF
+cat >expect.non-whitespace-is-word <<-\EOF
 	<BOLD>diff --git a/pre b/post<RESET>
-	<BOLD>index $pre..$post 100644<RESET>
+	<BOLD>index 330b04f..5ed8eff 100644<RESET>
 	<BOLD>--- a/pre<RESET>
 	<BOLD>+++ b/post<RESET>
 	<CYAN>@@ -1,3 +1,7 @@<RESET>
@@ -51,12 +49,9 @@ cat >expect.non-whitespace-is-word <<-EOF
 EOF
 
 word_diff () {
-	pre=$(git rev-parse --short $(git hash-object pre)) &&
-	post=$(git rev-parse --short $(git hash-object post)) &&
 	test_must_fail git diff --no-index "$@" pre post >output &&
 	test_decode_color <output >output.decrypted &&
-	sed -e "2s/index [^ ]*/index $pre..$post/" expect >expected
-	test_cmp expected output.decrypted
+	test_cmp expect output.decrypted
 }
 
 test_language_driver () {
@@ -82,9 +77,9 @@ test_expect_success 'set up pre and post with runs of whitespace' '
 '
 
 test_expect_success 'word diff with runs of whitespace' '
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index 330b04f..5ed8eff 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1,3 +1,7 @@<RESET>
@@ -102,9 +97,9 @@ test_expect_success 'word diff with runs of whitespace' '
 '
 
 test_expect_success '--word-diff=porcelain' '
-	sed 's/#.*$//' >expect <<-EOF &&
+	sed 's/#.*$//' >expect <<-\EOF &&
 		diff --git a/pre b/post
-		index $pre..$post 100644
+		index 330b04f..5ed8eff 100644
 		--- a/pre
 		+++ b/post
 		@@ -1,3 +1,7 @@
@@ -126,9 +121,9 @@ test_expect_success '--word-diff=porcelain' '
 '
 
 test_expect_success '--word-diff=plain' '
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		diff --git a/pre b/post
-		index $pre..$post 100644
+		index 330b04f..5ed8eff 100644
 		--- a/pre
 		+++ b/post
 		@@ -1,3 +1,7 @@
@@ -145,9 +140,9 @@ test_expect_success '--word-diff=plain' '
 '
 
 test_expect_success '--word-diff=plain --color' '
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index 330b04f..5ed8eff 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1,3 +1,7 @@<RESET>
@@ -163,9 +158,9 @@ test_expect_success '--word-diff=plain --color' '
 '
 
 test_expect_success 'word diff without context' '
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index 330b04f..5ed8eff 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1 +1 @@<RESET>
@@ -212,9 +207,9 @@ test_expect_success 'command-line overrides config' '
 '
 
 test_expect_success 'command-line overrides config: --word-diff-regex' '
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index 330b04f..5ed8eff 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1,3 +1,7 @@<RESET>
@@ -239,9 +234,9 @@ test_expect_success 'setup: remove diff driver regex' '
 '
 
 test_expect_success 'use configured regex' '
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index 330b04f..5ed8eff 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1,3 +1,7 @@<RESET>
@@ -259,11 +254,9 @@ test_expect_success 'use configured regex' '
 test_expect_success 'test parsing words for newline' '
 	echo "aaa (aaa)" >pre &&
 	echo "aaa (aaa) aaa" >post &&
-	pre=$(git rev-parse --short $(git hash-object pre)) &&
-	post=$(git rev-parse --short $(git hash-object post)) &&
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index c29453b..be22f37 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1 +1 @@<RESET>
@@ -275,11 +268,9 @@ test_expect_success 'test parsing words for newline' '
 test_expect_success 'test when words are only removed at the end' '
 	echo "(:" >pre &&
 	echo "(" >post &&
-	pre=$(git rev-parse --short $(git hash-object pre)) &&
-	post=$(git rev-parse --short $(git hash-object post)) &&
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		<BOLD>diff --git a/pre b/post<RESET>
-		<BOLD>index $pre..$post 100644<RESET>
+		<BOLD>index 289cb9d..2d06f37 100644<RESET>
 		<BOLD>--- a/pre<RESET>
 		<BOLD>+++ b/post<RESET>
 		<CYAN>@@ -1 +1 @@<RESET>
@@ -291,11 +282,9 @@ test_expect_success 'test when words are only removed at the end' '
 test_expect_success '--word-diff=none' '
 	echo "(:" >pre &&
 	echo "(" >post &&
-	pre=$(git rev-parse --short $(git hash-object pre)) &&
-	post=$(git rev-parse --short $(git hash-object post)) &&
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 		diff --git a/pre b/post
-		index $pre..$post 100644
+		index 289cb9d..2d06f37 100644
 		--- a/pre
 		+++ b/post
 		@@ -1 +1 @@
@@ -314,7 +303,6 @@ test_language_driver bibtex
 test_language_driver cpp
 test_language_driver csharp
 test_language_driver css
-test_language_driver dts
 test_language_driver fortran
 test_language_driver html
 test_language_driver java
@@ -328,6 +316,16 @@ test_language_driver ruby
 test_language_driver tex
 
 test_expect_success 'word-diff with diff.sbe' '
+	cat >expect <<-\EOF &&
+	diff --git a/pre b/post
+	index a1a53b5..bc8fe6d 100644
+	--- a/pre
+	+++ b/post
+	@@ -1,3 +1,3 @@
+	a
+
+	[-b-]{+c+}
+	EOF
 	cat >pre <<-\EOF &&
 	a
 
@@ -338,35 +336,21 @@ test_expect_success 'word-diff with diff.sbe' '
 
 	c
 	EOF
-	pre=$(git rev-parse --short $(git hash-object pre)) &&
-	post=$(git rev-parse --short $(git hash-object post)) &&
-	cat >expect <<-EOF &&
-	diff --git a/pre b/post
-	index $pre..$post 100644
-	--- a/pre
-	+++ b/post
-	@@ -1,3 +1,3 @@
-	a
-
-	[-b-]{+c+}
-	EOF
 	test_config diff.suppress-blank-empty true &&
 	word_diff --word-diff=plain
 '
 
 test_expect_success 'word-diff with no newline at EOF' '
-	printf "%s" "a a a a a" >pre &&
-	printf "%s" "a a ab a a" >post &&
-	pre=$(git rev-parse --short $(git hash-object pre)) &&
-	post=$(git rev-parse --short $(git hash-object post)) &&
-	cat >expect <<-EOF &&
+	cat >expect <<-\EOF &&
 	diff --git a/pre b/post
-	index $pre..$post 100644
+	index 7bf316e..3dd0303 100644
 	--- a/pre
 	+++ b/post
 	@@ -1 +1 @@
 	a a [-a-]{+ab+} a a
 	EOF
+	printf "%s" "a a a a a" >pre &&
+	printf "%s" "a a ab a a" >post &&
 	word_diff --word-diff=plain
 '