diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-11-03 15:32:25 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-11-03 15:32:25 -0800 |
commit | f89baca1b99ff2882690d6b58dc2071195c6ae84 (patch) | |
tree | 2901be0d9c8d2b46710fe97681b66b116127fd96 /t | |
parent | Merge branch 'js/gc-with-stale-symref' into maint (diff) | |
parent | introduce "preciousObjects" repository extension (diff) | |
download | tgif-f89baca1b99ff2882690d6b58dc2071195c6ae84.tar.xz |
Merge branch 'jk/repository-extension' into maint
Prepare for Git on-disk repository representation to undergo
backward incompatible changes by introducing a new repository
format version "1", with an extension mechanism.
* jk/repository-extension:
introduce "preciousObjects" repository extension
introduce "extensions" form of core.repositoryformatversion
Diffstat (limited to 't')
-rwxr-xr-x | t/t1302-repo-version.sh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh index 0d9388afc4..9bcd34969f 100755 --- a/t/t1302-repo-version.sh +++ b/t/t1302-repo-version.sh @@ -67,4 +67,64 @@ test_expect_success 'gitdir required mode' ' ) ' +check_allow () { + git rev-parse --git-dir >actual && + echo .git >expect && + test_cmp expect actual +} + +check_abort () { + test_must_fail git rev-parse --git-dir +} + +# avoid git-config, since it cannot be trusted to run +# in a repository with a broken version +mkconfig () { + echo '[core]' && + echo "repositoryformatversion = $1" && + shift && + + if test $# -gt 0; then + echo '[extensions]' && + for i in "$@"; do + echo "$i" + done + fi +} + +while read outcome version extensions; do + test_expect_success "$outcome version=$version $extensions" " + mkconfig $version $extensions >.git/config && + check_${outcome} + " +done <<\EOF +allow 0 +allow 1 +allow 1 noop +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 |