t4014: abstract away SHA-1-specific constants
Adjust the test so that it computes values for blobs instead of using hard-coded hashes. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
brian m. carlson committed
May 21, 2018 at 02:01 UTC
bdee9cd6c163d8b89a1ef87bbc09e394737df766
1 file changed
+6
-3
t/t4014-format-patch.sh
+6
-3
@@ -578,7 +578,11 @@ test_expect_success 'excessive subject' '
578
579
rm -rf patches/ &&
580
git checkout side &&
581
+ before=$(git hash-object file) &&
582
+ before=$(git rev-parse --short $before) &&
583
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file &&
584
+ after=$(git hash-object file) &&
585
+ after=$(git rev-parse --short $after) &&
586
git update-index file &&
587
git commit -m "This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole paragraph right at the start as the only thing in the commit message. It had better not become the filename for the patch." &&
588
git format-patch -o patches/ master..side &&
@@ -586,7 +590,6 @@ test_expect_success 'excessive subject' '
590
'
591
592
test_expect_success 'cover-letter inherits diff options' '
589
-
593
git mv file foo &&
594
git commit -m foo &&
595
git format-patch --no-renames --cover-letter -1 &&
@@ -616,7 +619,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
619
'
620
621
cat > expect << EOF
619
-index 40f36c6..2dc5c23 100644
622
+index $before..$after 100644
623
--- a/file
624
+++ b/file
625
@@ -13,4 +13,20 @@ C
@@ -640,7 +643,7 @@ test_expect_success 'format-patch respects -U' '
643
cat > expect << EOF
644
645
diff --git a/file b/file
643
-index 40f36c6..2dc5c23 100644
646
+index $before..$after 100644
647
--- a/file
648
+++ b/file
649
@@ -14,3 +14,19 @@ C