Skip to content

Commit 0de267b

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

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

t/t0002-gitfile.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ test_expect_success 'enter_repo non-strict mode' '
9292
mv .git .realgit &&
9393
echo "gitdir: .realgit" >.git
9494
) &&
95+
head=$(git -C enter_repo rev-parse HEAD) &&
9596
git ls-remote enter_repo >actual &&
96-
cat >expected <<-\EOF &&
97-
946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
98-
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
99-
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
97+
cat >expected <<-EOF &&
98+
$head HEAD
99+
$head refs/heads/master
100+
$head refs/tags/foo
100101
EOF
101102
test_cmp expected actual
102103
'
@@ -106,21 +107,23 @@ test_expect_success 'enter_repo linked checkout' '
106107
cd enter_repo &&
107108
git worktree add ../foo refs/tags/foo
108109
) &&
110+
head=$(git -C enter_repo rev-parse HEAD) &&
109111
git ls-remote foo >actual &&
110-
cat >expected <<-\EOF &&
111-
946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
112-
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
113-
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
112+
cat >expected <<-EOF &&
113+
$head HEAD
114+
$head refs/heads/master
115+
$head refs/tags/foo
114116
EOF
115117
test_cmp expected actual
116118
'
117119

118120
test_expect_success 'enter_repo strict mode' '
121+
head=$(git -C enter_repo rev-parse HEAD) &&
119122
git ls-remote --upload-pack="git upload-pack --strict" foo/.git >actual &&
120-
cat >expected <<-\EOF &&
121-
946e985ab20de757ca5b872b16d64e92ff3803a9 HEAD
122-
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/heads/master
123-
946e985ab20de757ca5b872b16d64e92ff3803a9 refs/tags/foo
123+
cat >expected <<-EOF &&
124+
$head HEAD
125+
$head refs/heads/master
126+
$head refs/tags/foo
124127
EOF
125128
test_cmp expected actual
126129
'

0 commit comments

Comments
 (0)