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>
maint
brian m. carlson7 years agocommitted byJunio C Hamano
@ -27,29 +27,32 @@ Further, with -B and -M together, these should turn into two renames.
@@ -27,29 +27,32 @@ Further, with -B and -M together, these should turn into two renames.
test_expect_success setup '
cat "$TEST_DIRECTORY"/diff-lib/README >file0 &&
cat "$TEST_DIRECTORY"/diff-lib/COPYING >file1 &&
blob0_id=$(git hash-object file0) &&
blob1_id=$(git hash-object file1) &&
git update-index --add file0 file1 &&
git tag reference $(git write-tree)
'
test_expect_success 'change file1 with copy-edit of file0 and remove file0' '
sed -e "s/git/GIT/" file0 >file1 &&
blob2_id=$(git hash-object file1) &&
rm -f file0 &&
git update-index --remove file0 file1
'
test_expect_success 'run diff with -B (#1)' '
git diff-index -B --cached reference >current &&
cat >expect <<-\EOF &&
:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D file0
# This should not mistake file0 as the copy source of new file1
# due to type differences.
cat >expect <<-\EOF &&
:100644 120000 548142c327a6790ff8821d67c2ee1eff7a656b52 67be421f88824578857624f7b3dc75e99a8a1481 T file0
:100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 548142c327a6790ff8821d67c2ee1eff7a656b52 M file1
cat >expect <<-EOF &&
:100644 120000 $blob0_id $slink_id T file0
:100644 100644 $blob1_id $blob0_id M file1
EOF
compare_diff_raw expect current
'
@ -128,25 +132,26 @@ test_expect_success 'file1 edited to look like file0 and file0 rename-edited to
@@ -128,25 +132,26 @@ test_expect_success 'file1 edited to look like file0 and file0 rename-edited to
git checkout-index -f -u -a &&
sed -e "s/git/GIT/" file0 >file1 &&
sed -e "s/git/GET/" file0 >file2 &&
blob3_id=$(git hash-object file2) &&
rm -f file0 &&
git update-index --add --remove file0 file1 file2
'
test_expect_success 'run diff with -B (#8)' '
git diff-index -B reference >current &&
cat >expect <<-\EOF &&
:100644 000000 548142c327a6790ff8821d67c2ee1eff7a656b52 0000000000000000000000000000000000000000 D file0