diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-23 20:44:27 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-23 20:44:27 +0200 |
commit | 16c73d3804407e338c7f88d5a076e3eb9786fe56 (patch) | |
tree | 261241105f734476b8161ba11af92a59bbc8bc3e /tests/repo | |
parent | 99e11cdd0231ec84ac0d0fc476803f067da97a34 (diff) | |
download | libgit2-16c73d3804407e338c7f88d5a076e3eb9786fe56.tar.gz |
repository: check the format versioncmn/repo-version-check
This is something we do on re-init but not when opening a
repository. This hasn't particularly mattered up to now as the version
has been 0 ever since the first release of git, but the times, they're
a-changing and we will soon see version 1 in the wild. We need to make
sure we don't open those.
Diffstat (limited to 'tests/repo')
-rw-r--r-- | tests/repo/open.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/repo/open.c b/tests/repo/open.c index 637c785d5..6a5ab24fb 100644 --- a/tests/repo/open.c +++ b/tests/repo/open.c @@ -20,6 +20,23 @@ void test_repo_open__bare_empty_repo(void) cl_assert(git_repository_workdir(repo) == NULL); } +void test_repo_open__format_version_1(void) +{ + git_buf path = GIT_BUF_INIT; + git_repository *repo; + git_config *config; + + repo = cl_git_sandbox_init("empty_bare.git"); + + cl_git_pass(git_repository_open(&repo, "empty_bare.git")); + cl_git_pass(git_repository_config__weakptr(&config, repo)); + + cl_git_pass(git_config_set_int32(config, "core.repositoryformatversion", 1)); + + git_repository_free(repo); + cl_git_fail(git_repository_open(&repo, "empty_bare.git")); +} + void test_repo_open__standard_empty_repo_through_gitdir(void) { git_repository *repo; |