summaryrefslogtreecommitdiff
path: root/t/t4014-format-patch.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-30 12:51:28 (GMT)
commit9472b13201aea57d7f9212ca2678aba4d6dbdfdb (patch)
treee556c8294e01e367c373a6ac0eb6feeb980d7b65 /t/t4014-format-patch.sh
parentd89f1248aaf4bb5d1094bc991a50839411935cf6 (diff)
parenteea253bf39c0a8f9995bea1a4c648829c36b79d7 (diff)
downloadgit-9472b13201aea57d7f9212ca2678aba4d6dbdfdb.zip
git-9472b13201aea57d7f9212ca2678aba4d6dbdfdb.tar.gz
git-9472b13201aea57d7f9212ca2678aba4d6dbdfdb.tar.bz2
Merge branch 'bc/hash-independent-tests'
Many tests hardcode the raw object names, which would change once we migrate away from SHA-1. While some of them must test against exact object names, most of them do not have to use hardcoded constants in the test. The latter kind of tests have been updated to test the moral equivalent of the original without hardcoding the actual object names. * bc/hash-independent-tests: (28 commits) t5300: abstract away SHA-1-specific constants t4208: abstract away SHA-1-specific constants t4045: abstract away SHA-1-specific constants t4042: abstract away SHA-1-specific constants t4205: sort log output in a hash-independent way t/lib-diff-alternative: abstract away SHA-1-specific constants t4030: abstract away SHA-1-specific constants t4029: abstract away SHA-1-specific constants t4029: fix test indentation t4022: abstract away SHA-1-specific constants t4020: abstract away SHA-1-specific constants t4014: abstract away SHA-1-specific constants t4008: abstract away SHA-1-specific constants t4007: abstract away SHA-1-specific constants t3905: abstract away SHA-1-specific constants t3702: abstract away SHA-1-specific constants t3103: abstract away SHA-1-specific constants t2203: abstract away SHA-1-specific constants t: skip pack tests if not using SHA-1 t4044: skip test if not using SHA-1 ...
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-xt/t4014-format-patch.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 6ea08fd..028d550 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -578,7 +578,11 @@ test_expect_success 'excessive subject' '
rm -rf patches/ &&
git checkout side &&
+ before=$(git hash-object file) &&
+ before=$(git rev-parse --short $before) &&
for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file &&
+ after=$(git hash-object file) &&
+ after=$(git rev-parse --short $after) &&
git update-index file &&
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." &&
git format-patch -o patches/ master..side &&
@@ -586,7 +590,6 @@ test_expect_success 'excessive subject' '
'
test_expect_success 'cover-letter inherits diff options' '
-
git mv file foo &&
git commit -m foo &&
git format-patch --no-renames --cover-letter -1 &&
@@ -616,7 +619,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
'
cat > expect << EOF
-index 40f36c6..2dc5c23 100644
+index $before..$after 100644
--- a/file
+++ b/file
@@ -13,4 +13,20 @@ C
@@ -640,7 +643,7 @@ test_expect_success 'format-patch respects -U' '
cat > expect << EOF
diff --git a/file b/file
-index 40f36c6..2dc5c23 100644
+index $before..$after 100644
--- a/file
+++ b/file
@@ -14,3 +14,19 @@ C
@@ -1523,14 +1526,14 @@ test_expect_success 'cover letter auto user override' '
test_expect_success 'format-patch --zero-commit' '
git format-patch --zero-commit --stdout v2..v1 >patch2 &&
grep "^From " patch2 | sort | uniq >actual &&
- echo "From $_z40 Mon Sep 17 00:00:00 2001" >expect &&
+ echo "From $ZERO_OID Mon Sep 17 00:00:00 2001" >expect &&
test_cmp expect actual
'
test_expect_success 'From line has expected format' '
git format-patch --stdout v2..v1 >patch2 &&
grep "^From " patch2 >from &&
- grep "^From $_x40 Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
+ grep "^From $OID_REGEX Mon Sep 17 00:00:00 2001$" patch2 >filtered &&
test_cmp from filtered
'