t5000, t5003: simplify commit

Add the whole directory of test files at once using git add instead of calling git update-index on each of them and use git commit instead of the plumbing commands write-tree, update-ref and commit-tree to build the commit. This simplifies the code considerably. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Jul 5, 2014 at 21:35 UTC 21711ca4b2a387b587c90e0ad8a98170e4b006e4
2 files changed +8 -16
t/t5000-tar-tree.sh
+4 -8
@@ -119,14 +119,10 @@ test_expect_success \
119 'echo ignore me >a/ignored &&
120 echo ignored export-ignore >.git/info/attributes'
121
122 -test_expect_success \
123 - 'add files to repository' \
124 - 'find a -type f | xargs git update-index --add &&
125 - find a -type l | xargs git update-index --add &&
126 - treeid=$(git write-tree) &&
127 - echo $treeid >treeid &&
128 - git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
129 - git commit-tree $treeid </dev/null)'
122 +test_expect_success 'add files to repository' '
123 + git add a &&
124 + GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial
125 +'
126
127 test_expect_success 'setup export-subst' '
128 echo "substfile?" export-subst >>.git/info/attributes &&
t/t5003-archive-zip.sh
+4 -8
@@ -61,14 +61,10 @@ test_expect_success \
61 'echo ignore me >a/ignored &&
62 echo ignored export-ignore >.git/info/attributes'
63
64 -test_expect_success \
65 - 'add files to repository' \
66 - 'find a -type f | xargs git update-index --add &&
67 - find a -type l | xargs git update-index --add &&
68 - treeid=`git write-tree` &&
69 - echo $treeid >treeid &&
70 - git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
71 - git commit-tree $treeid </dev/null)'
64 +test_expect_success 'add files to repository' '
65 + git add a &&
66 + GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial
67 +'
68
69 test_expect_success 'setup export-subst' '
70 echo "substfile?" export-subst >>.git/info/attributes &&