summaryrefslogtreecommitdiff
path: root/t/t4045-diff-relative.sh
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2018-05-21 02:01:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-05-21 04:55:48 (GMT)
commit5c024287ad9e523d2fbd0bce6e2786fe7231e0f3 (patch)
tree4417205533f8a3dd7ca617faeddf8e821c6d4843 /t/t4045-diff-relative.sh
parente4c565230450b70d78764a87553af7900c6b4064 (diff)
downloadgit-5c024287ad9e523d2fbd0bce6e2786fe7231e0f3.zip
git-5c024287ad9e523d2fbd0bce6e2786fe7231e0f3.tar.gz
git-5c024287ad9e523d2fbd0bce6e2786fe7231e0f3.tar.bz2
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 <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4045-diff-relative.sh')
-rwxr-xr-xt/t4045-diff-relative.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/t/t4045-diff-relative.sh b/t/t4045-diff-relative.sh
index 6471a68..36f8ed8 100755
--- a/t/t4045-diff-relative.sh
+++ b/t/t4045-diff-relative.sh
@@ -8,6 +8,7 @@ test_expect_success 'setup' '
echo content >file1 &&
mkdir subdir &&
echo other content >subdir/file2 &&
+ blob=$(git hash-object subdir/file2) &&
git add . &&
git commit -m one
'
@@ -17,10 +18,11 @@ check_diff () {
shift
expect=$1
shift
+ short_blob=$(git rev-parse --short $blob)
cat >expected <<-EOF
diff --git a/$expect b/$expect
new file mode 100644
- index 0000000..25c05ef
+ index 0000000..$short_blob
--- /dev/null
+++ b/$expect
@@ -0,0 +1 @@
@@ -68,7 +70,7 @@ check_raw () {
expect=$1
shift
cat >expected <<-EOF
- :000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect
+ :000000 100644 0000000000000000000000000000000000000000 $blob A $expect
EOF
test_expect_success "--raw $*" "
git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&