archive: don't let remote clients get unreachable commits
[gitweb.git] / t / t5000-tar-tree.sh
index c942c8be85339157e22f755d8fc94e64efaee4dd..1a2ee105a464ad007727cb2e4bd42de686c0d005 100755 (executable)
@@ -213,4 +213,12 @@ test_expect_success \
     'git archive --list outside of a git repo' \
     'GIT_DIR=some/non-existing/directory git archive --list'
 
+test_expect_success 'clients cannot access unreachable commits' '
+       test_commit unreachable &&
+       sha1=`git rev-parse HEAD` &&
+       git reset --hard HEAD^ &&
+       git archive $sha1 >remote.tar &&
+       test_must_fail git archive --remote=. $sha1 >remote.tar
+'
+
 test_done