Merge branch 'jt/use-trailer-api-in-commands'
[gitweb.git] / t / t5000-tar-tree.sh
index 80b2387341c3a7abb9cc4b126376d7dd755d9e1d..830bf2a2f6d4d85358a54f58f74b4ed9fdc954d5 100755 (executable)
@@ -94,6 +94,20 @@ check_tar() {
        '
 }
 
+# run "$@" inside a non-git directory
+nongit () {
+       test -d non-repo ||
+       mkdir non-repo ||
+       return 1
+
+       (
+               GIT_CEILING_DIRECTORIES=$(pwd) &&
+               export GIT_CEILING_DIRECTORIES &&
+               cd non-repo &&
+               "$@"
+       )
+}
+
 test_expect_success \
     'populate workdir' \
     'mkdir a &&
@@ -179,6 +193,15 @@ test_expect_success 'git archive --remote' \
     'git archive --remote=. HEAD >b5.tar &&
     test_cmp_bin b.tar b5.tar'
 
+test_expect_success 'git archive --remote with configured remote' '
+       git config remote.foo.url . &&
+       (
+               cd a &&
+               git archive --remote=foo --output=../b5-nick.tar HEAD
+       ) &&
+       test_cmp_bin b.tar b5-nick.tar
+'
+
 test_expect_success \
     'validate file modification time' \
     'mkdir extract &&
@@ -197,9 +220,15 @@ test_expect_success 'git archive with --output, override inferred format' '
        test_cmp_bin b.tar d4.zip
 '
 
-test_expect_success \
-    'git archive --list outside of a git repo' \
-    'GIT_DIR=some/non-existing/directory git archive --list'
+test_expect_success 'git archive --list outside of a git repo' '
+       nongit git archive --list
+'
+
+test_expect_success 'git archive --remote outside of a git repo' '
+       git archive HEAD >expect.tar &&
+       nongit git archive --remote="$PWD" HEAD >actual.tar &&
+       test_cmp_bin expect.tar actual.tar
+'
 
 test_expect_success 'clients cannot access unreachable commits' '
        test_commit unreachable &&