diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-10-26 15:55:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-10-26 15:55:25 -0700 |
commit | fa46579555583a9799d8495f632b14cddd65db6e (patch) | |
tree | a2f1155dfc4bd642795ec59e943776ef68e26f67 /t | |
parent | Merge branch 'dt/t7063-fix-flaky-test' (diff) | |
parent | introduce "preciousObjects" repository extension (diff) | |
download | tgif-fa46579555583a9799d8495f632b14cddd65db6e.tar.xz |
Merge branch 'jk/repository-extension'
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 |