diff options
author | Jeff King <peff@peff.net> | 2015-06-23 06:54:11 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-06-24 17:09:35 -0700 |
commit | 067fbd4105c5aa8260a73cc6961854be0e93fa03 (patch) | |
tree | 302bb72cb8414580c24bd4d896bc4879e31b8a66 /t/t1302-repo-version.sh | |
parent | 00a09d57eb8a041e6a6b0470c53533719c049bab (diff) | |
download | git-067fbd4105c5aa8260a73cc6961854be0e93fa03.tar.gz git-067fbd4105c5aa8260a73cc6961854be0e93fa03.tar.xz |
introduce "preciousObjects" repository extension
If this extension is used in a repository, then no
operations should run which may drop objects from the object
storage. This can be useful if you are sharing that storage
with other repositories whose refs you cannot see.
For instance, if you do:
$ git clone -s parent child
$ git -C parent config extensions.preciousObjects true
$ git -C parent config core.repositoryformatversion 1
you now have additional safety when running git in the
parent repository. Prunes and repacks will bail with an
error, and `git gc` will skip those operations (it will
continue to pack refs and do other non-object operations).
Older versions of git, when run in the repository, will
fail on every operation.
Note that we do not set the preciousObjects extension by
default when doing a "clone -s", as doing so breaks
backwards compatibility. It is a decision the user should
make explicitly.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1302-repo-version.sh')
-rwxr-xr-x | t/t1302-repo-version.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh index 8dd6fd7ba..9bcd34969 100755 --- a/t/t1302-repo-version.sh +++ b/t/t1302-repo-version.sh @@ -105,4 +105,26 @@ abort 1 no-such-extension allow 0 no-such-extension EOF +test_expect_success 'precious-objects allowed' ' + mkconfig 1 preciousObjects >.git/config && + check_allow +' + +test_expect_success 'precious-objects blocks destructive repack' ' + test_must_fail git repack -ad +' + +test_expect_success 'other repacks are OK' ' + test_commit foo && + git repack +' + +test_expect_success 'precious-objects blocks prune' ' + test_must_fail git prune +' + +test_expect_success 'gc runs without complaint' ' + git gc +' + test_done |