Skip to content

Commit

Permalink
t5000, t5003: simplify commit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Jul 7, 2014
1 parent 6f92e5f commit 21711ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions t/t5000-tar-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
12 changes: 4 additions & 8 deletions t/t5003-archive-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 21711ca

Please sign in to comment.