Skip to content

Commit bdee9cd

Browse files
bk2204gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 75fe818 commit bdee9cd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t4014-format-patch.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,15 +578,18 @@ test_expect_success 'excessive subject' '
578578
579579
rm -rf patches/ &&
580580
git checkout side &&
581+
before=$(git hash-object file) &&
582+
before=$(git rev-parse --short $before) &&
581583
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) &&
582586
git update-index file &&
583587
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." &&
584588
git format-patch -o patches/ master..side &&
585589
ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch
586590
'
587591

588592
test_expect_success 'cover-letter inherits diff options' '
589-
590593
git mv file foo &&
591594
git commit -m foo &&
592595
git format-patch --no-renames --cover-letter -1 &&
@@ -616,7 +619,7 @@ test_expect_success 'shortlog of cover-letter wraps overly-long onelines' '
616619
'
617620

618621
cat > expect << EOF
619-
index 40f36c6..2dc5c23 100644
622+
index $before..$after 100644
620623
--- a/file
621624
+++ b/file
622625
@@ -13,4 +13,20 @@ C
@@ -640,7 +643,7 @@ test_expect_success 'format-patch respects -U' '
640643
cat > expect << EOF
641644
642645
diff --git a/file b/file
643-
index 40f36c6..2dc5c23 100644
646+
index $before..$after 100644
644647
--- a/file
645648
+++ b/file
646649
@@ -14,3 +14,19 @@ C

0 commit comments

Comments
 (0)