Skip to content

Commit c420df7

Browse files
René Scharfegitster
authored andcommitted
t5000: integrate export-subst tests into regular tests
Instead of creating extra archives for testing substitutions, set the attribute export-subst and overwrite the marked file with the expected (expanded) content right between committing and archiving. Thus placeholder expansion based on the committed content is performed with each archive creation and the comparison with the contents of directory a yields the correct result. We can then remove the special tests for export-subst. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5dbe064 commit c420df7

File tree

1 file changed

+6
-32
lines changed

1 file changed

+6
-32
lines changed

t/t5000-tar-tree.sh

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ test_expect_success \
6262
git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
6363
git commit-tree $treeid </dev/null)'
6464

65+
test_expect_success 'setup export-subst' '
66+
echo "substfile?" export-subst >>.git/info/attributes &&
67+
git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
68+
>a/substfile1
69+
'
70+
6571
test_expect_success \
6672
'create bare clone' \
6773
'git clone --bare . bare.git &&
@@ -148,38 +154,6 @@ test_expect_success \
148154
'validate file contents with prefix' \
149155
'diff -r a c/prefix/a'
150156

151-
test_expect_success \
152-
'create archives with substfiles' \
153-
'cp .git/info/attributes .git/info/attributes.before &&
154-
echo "substfile?" export-subst >>.git/info/attributes &&
155-
git archive HEAD >f.tar &&
156-
git archive --prefix=prefix/ HEAD >g.tar &&
157-
mv .git/info/attributes.before .git/info/attributes'
158-
159-
test_expect_success \
160-
'extract substfiles' \
161-
'(mkdir f && cd f && "$TAR" xf -) <f.tar'
162-
163-
test_expect_success \
164-
'validate substfile contents' \
165-
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
166-
>f/a/substfile1.expected &&
167-
test_cmp f/a/substfile1.expected f/a/substfile1 &&
168-
test_cmp a/substfile2 f/a/substfile2
169-
'
170-
171-
test_expect_success \
172-
'extract substfiles from archive with prefix' \
173-
'(mkdir g && cd g && "$TAR" xf -) <g.tar'
174-
175-
test_expect_success \
176-
'validate substfile contents from archive with prefix' \
177-
'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
178-
>g/prefix/a/substfile1.expected &&
179-
test_cmp g/prefix/a/substfile1.expected g/prefix/a/substfile1 &&
180-
test_cmp a/substfile2 g/prefix/a/substfile2
181-
'
182-
183157
test_expect_success 'git archive with --output, override inferred format' '
184158
git archive --format=tar --output=d4.zip HEAD &&
185159
test_cmp b.tar d4.zip

0 commit comments

Comments
 (0)