t5000, t5003: simplify commit
authorRené Scharfe <l.s.r@web.de>
Sat, 5 Jul 2014 19:35:01 +0000 (21:35 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Jul 2014 21:10:13 +0000 (14:10 -0700)
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>
t/t5000-tar-tree.sh
t/t5003-archive-zip.sh
index 899c1c5bbcb2e994a1462eb8048344b68d23767d..7b8babd89b22dc94d3a3f839d72cce86c5aaea59 100755 (executable)
@@ -119,14 +119,10 @@ test_expect_success \
     'echo ignore me >a/ignored &&
      echo ignored export-ignore >.git/info/attributes'
 
-test_expect_success \
-    'add files to repository' \
-    'find a -type f | xargs git update-index --add &&
-     find a -type l | xargs git update-index --add &&
-     treeid=$(git write-tree) &&
-     echo $treeid >treeid &&
-     git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
-     git commit-tree $treeid </dev/null)'
+test_expect_success 'add files to repository' '
+       git add a &&
+       GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial
+'
 
 test_expect_success 'setup export-subst' '
        echo "substfile?" export-subst >>.git/info/attributes &&
index 21a5c93f41e28845a540637eb11bd6eec830a063..c929db563326614e01962b3e322f087640fa19d9 100755 (executable)
@@ -61,14 +61,10 @@ test_expect_success \
     'echo ignore me >a/ignored &&
      echo ignored export-ignore >.git/info/attributes'
 
-test_expect_success \
-    'add files to repository' \
-    'find a -type f | xargs git update-index --add &&
-     find a -type l | xargs git update-index --add &&
-     treeid=`git write-tree` &&
-     echo $treeid >treeid &&
-     git update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
-     git commit-tree $treeid </dev/null)'
+test_expect_success 'add files to repository' '
+       git add a &&
+       GIT_COMMITTER_DATE="2005-05-27 22:00" git commit -m initial
+'
 
 test_expect_success 'setup export-subst' '
        echo "substfile?" export-subst >>.git/info/attributes &&