summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-23 20:43:49 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-23 20:43:49 +0200
commit99e11cdd0231ec84ac0d0fc476803f067da97a34 (patch)
treee63a628f3bfa7cbba998db20bdfbe580e99782b4
parent0c34fa5094ba624ebe398d1b154fd27c207108cb (diff)
downloadlibgit2-99e11cdd0231ec84ac0d0fc476803f067da97a34.tar.gz
repository: don't error out if there is no version
git will assume the repository format version is 0 if the value is not there. Do the same.
-rw-r--r--src/repository.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/repository.c b/src/repository.c
index c608fa0b8..49778d175 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -931,9 +931,14 @@ bool git_repository__reserved_names(
static int check_repositoryformatversion(git_config *config)
{
- int version;
+ int version, error;
- if (git_config_get_int32(&version, config, "core.repositoryformatversion") < 0)
+ error = git_config_get_int32(&version, config, "core.repositoryformatversion");
+ /* git ignores this if the config variable isn't there */
+ if (error == GIT_ENOTFOUND)
+ return 0;
+
+ if (error < 0)
return -1;
if (GIT_REPO_VERSION < version) {