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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed May 20, 2013 at 11:58 UTC c420df7b9bbfcf352a3602c78e8476f18098bb43
1 file changed +6 -32
t/t5000-tar-tree.sh
+6 -32
@@ -62,6 +62,12 @@ test_expect_success \
62 git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
63 git commit-tree $treeid </dev/null)'
64
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 +
71 test_expect_success \
72 'create bare clone' \
73 'git clone --bare . bare.git &&
@@ -148,38 +154,6 @@ test_expect_success \
154 'validate file contents with prefix' \
155 'diff -r a c/prefix/a'
156
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 -
157 test_expect_success 'git archive with --output, override inferred format' '
158 git archive --format=tar --output=d4.zip HEAD &&
159 test_cmp b.tar d4.zip