Skip to content

Commit 5c02428

Browse files
bk2204gitster
authored andcommitted
t4045: abstract away SHA-1-specific constants
Adjust the test so that it computes variables 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 e4c5652 commit 5c02428

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

t/t4045-diff-relative.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ test_expect_success 'setup' '
88
echo content >file1 &&
99
mkdir subdir &&
1010
echo other content >subdir/file2 &&
11+
blob=$(git hash-object subdir/file2) &&
1112
git add . &&
1213
git commit -m one
1314
'
@@ -17,10 +18,11 @@ check_diff () {
1718
shift
1819
expect=$1
1920
shift
21+
short_blob=$(git rev-parse --short $blob)
2022
cat >expected <<-EOF
2123
diff --git a/$expect b/$expect
2224
new file mode 100644
23-
index 0000000..25c05ef
25+
index 0000000..$short_blob
2426
--- /dev/null
2527
+++ b/$expect
2628
@@ -0,0 +1 @@
@@ -68,7 +70,7 @@ check_raw () {
6870
expect=$1
6971
shift
7072
cat >expected <<-EOF
71-
:000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
73+
:000000 100644 0000000000000000000000000000000000000000 $blob A $expect
7274
EOF
7375
test_expect_success "--raw $*" "
7476
git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&

0 commit comments

Comments
 (0)