diff options
author | Jeff King <peff@peff.net> | 2016-12-15 21:30:59 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-12-16 09:29:43 -0800 |
commit | 7176a31444ce5ed683dbd75d2e1e2f89018d0100 (patch) | |
tree | c761e0c35d397e67bcfe7fa14b891ad998fb0e5e /t/t5300-pack-object.sh | |
parent | de95302a4c0c6c733fb734b5a3d3d54dd54ec674 (diff) | |
download | git-7176a31444ce5ed683dbd75d2e1e2f89018d0100.tar.gz |
index-pack: complain when --stdin is used outside of a repo
The index-pack builtin is marked as RUN_SETUP_GENTLY,
because it's perfectly fine to index a pack in the
filesystem outside of any repository. However, --stdin mode
will write the result to the object database, which does not
make sense outside of a repository. Doing so creates a bogus
".git" directory with nothing in it except the newly-created
pack and its index.
Instead, let's flag this as an error and abort.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5300-pack-object.sh')
-rwxr-xr-x | t/t5300-pack-object.sh | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 899e52d50f..43a672c345 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -406,6 +406,21 @@ test_expect_success 'verify resulting packs' ' git verify-pack test-11-*.pack ' +test_expect_success 'set up pack for non-repo tests' ' + # make sure we have a pack with no matching index file + cp test-1-*.pack foo.pack +' + +test_expect_success 'index-pack --stdin complains of non-repo' ' + nongit test_must_fail git index-pack --stdin <foo.pack && + test_path_is_missing non-repo/.git +' + +test_expect_success 'index-pack <pack> works in non-repo' ' + nongit git index-pack ../foo.pack && + test_path_is_file foo.idx +' + # # WARNING! # |