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>
brian m. carlson committed
Sep 13, 2018 at 05:17 UTC
0de267b2928ab907d658f2661932d972b71c0a8f
1 file changed
+15
-12
t/t0002-gitfile.sh
+15
-12
@@ -92,11 +92,12 @@ test_expect_success 'enter_repo non-strict mode' '
92
mv .git .realgit &&
93
echo "gitdir: .realgit" >.git
94
) &&
95
+ head=$(git -C enter_repo rev-parse HEAD) &&
96
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
101
EOF
102
test_cmp expected actual
103
'
@@ -106,21 +107,23 @@ test_expect_success 'enter_repo linked checkout' '
107
cd enter_repo &&
108
git worktree add ../foo refs/tags/foo
109
) &&
110
+ head=$(git -C enter_repo rev-parse HEAD) &&
111
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
116
EOF
117
test_cmp expected actual
118
'
119
120
test_expect_success 'enter_repo strict mode' '
121
+ head=$(git -C enter_repo rev-parse HEAD) &&
122
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
127
EOF
128
test_cmp expected actual
129
'