diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-11-22 13:37:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-11-22 13:55:20 -0800 |
commit | eb0224c617ba6b4299f2a9f85d6c4b3b5e10abc0 (patch) | |
tree | e619ede7551b1afd632defa778924abafabc87d4 /t/t5000-tar-tree.sh | |
parent | 3f0ec0687d95e0f53c899f964d769ca1846874da (diff) | |
download | git-eb0224c617ba6b4299f2a9f85d6c4b3b5e10abc0.tar.gz |
archive: read local configurationjc/setup-cleanup-fix
Since b9605bc4f2 ("config: only read .git/config from configured
repos", 2016-09-12), we do not read from ".git/config" unless we
know we are in a repository. "git archive" however didn't do the
repository discovery and instead relied on the old behaviour.
Teach the command to run a "gentle" version of repository discovery
so that local configuration variables are honoured.
[jc: stole tests from peff]
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5000-tar-tree.sh')
-rwxr-xr-x | t/t5000-tar-tree.sh | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 80b2387341..830bf2a2f6 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -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 && |