t0002: abstract away SHA-1 specific constants

Adjust the test so that it computes variables for object IDs instead of
using hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
brian m. carlson 2018-09-13 05:17:34 +00:00 коммит произвёл Junio C Hamano
Родитель e483e1441a
Коммит 0de267b292
1 изменённых файлов: 15 добавлений и 12 удалений

Просмотреть файл

@ -92,11 +92,12 @@ test_expect_success 'enter_repo non-strict mode' '
mv .git .realgit && mv .git .realgit &&
echo "gitdir: .realgit" >.git echo "gitdir: .realgit" >.git
) && ) &&
head=$(git -C enter_repo rev-parse HEAD) &&
git ls-remote enter_repo >actual && git ls-remote enter_repo >actual &&
cat >expected <<-\EOF && cat >expected <<-EOF &&
946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD $head HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master $head refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo $head refs/tags/foo
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
@ -106,21 +107,23 @@ test_expect_success 'enter_repo linked checkout' '
cd enter_repo && cd enter_repo &&
git worktree add ../foo refs/tags/foo git worktree add ../foo refs/tags/foo
) && ) &&
head=$(git -C enter_repo rev-parse HEAD) &&
git ls-remote foo >actual && git ls-remote foo >actual &&
cat >expected <<-\EOF && cat >expected <<-EOF &&
946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD $head HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master $head refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo $head refs/tags/foo
EOF EOF
test_cmp expected actual test_cmp expected actual
' '
test_expect_success 'enter_repo strict mode' ' test_expect_success 'enter_repo strict mode' '
head=$(git -C enter_repo rev-parse HEAD) &&
git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual && git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
cat >expected <<-\EOF && cat >expected <<-EOF &&
946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD $head HEAD
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master $head refs/heads/master
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo $head refs/tags/foo
EOF EOF
test_cmp expected actual test_cmp expected actual
' '