X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=t%2Ft5000-tar-tree.sh;h=e223c074f043571ff868a2f4783c7cc155185004;hb=566f5b217df73d6a642a0857cc5c13c11f84e7c3;hp=278eb6670116d0036413a81fc129615974458e5d;hpb=f4e96f97e85c145616bc2e23e9441bc0daa2906e;p=git.git diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 278eb6670..e223c074f 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -10,7 +10,7 @@ commit id embedding: The contents of the repository is compared to the extracted tar archive. The repository contains simple text files, symlinks and a - binary file (/bin/sh). Only pathes shorter than 99 characters are + binary file (/bin/sh). Only paths shorter than 99 characters are used. git-tar-tree applies the commit date to every file in the archive it @@ -26,6 +26,7 @@ commit id embedding: . ./test-lib.sh TAR=${TAR:-tar} +UNZIP=${UNZIP:-unzip} test_expect_success \ 'populate workdir' \ @@ -48,9 +49,17 @@ test_expect_success \ git-update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \ git-commit-tree $treeid b.tar' + test_expect_success \ 'git-tar-tree' \ - 'git-tar-tree HEAD >b.tar' + 'git-tar-tree HEAD >b2.tar' + +test_expect_success \ + 'git-archive vs. git-tar-tree' \ + 'diff b.tar b2.tar' test_expect_success \ 'validate file modification time' \ @@ -95,4 +104,42 @@ test_expect_success \ 'validate file contents with prefix' \ 'diff -r a c/prefix/a' +test_expect_success \ + 'git-archive --format=zip' \ + 'git-archive --format=zip HEAD >d.zip' + +test_expect_success \ + 'extract ZIP archive' \ + '(mkdir d && cd d && $UNZIP ../d.zip)' + +test_expect_success \ + 'validate filenames' \ + '(cd d/a && find .) | sort >d.lst && + diff a.lst d.lst' + +test_expect_success \ + 'validate file contents' \ + 'diff -r a d/a' + +test_expect_success \ + 'git-archive --format=zip with prefix' \ + 'git-archive --format=zip --prefix=prefix/ HEAD >e.zip' + +test_expect_success \ + 'extract ZIP archive with prefix' \ + '(mkdir e && cd e && $UNZIP ../e.zip)' + +test_expect_success \ + 'validate filenames with prefix' \ + '(cd e/prefix/a && find .) | sort >e.lst && + diff a.lst e.lst' + +test_expect_success \ + 'validate file contents with prefix' \ + 'diff -r a e/prefix/a' + +test_expect_success \ + 'git-archive --list outside of a git repo' \ + 'GIT_DIR=some/non-existing/directory git-archive --list' + test_done