ls-tree: major rewrite to do pathspec
[gitweb.git] / setup.c
diff --git a/setup.c b/setup.c
index ab3c778e805c166446d05c27617552da0f951f8c..cc44a724bf3220de1cb8a3ef818e581905d7265c 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -154,8 +154,25 @@ static const char *setup_git_directory_1(void)
        return cwd + offset;
 }
 
+int check_repository_format_version(const char *var, const char *value)
+{
+       if (strcmp(var, "core.repositoryformatversion") == 0)
+               repository_format_version = git_config_int(var, value);
+       return 0;
+}
+
+int check_repository_format(void)
+{
+       git_config(check_repository_format_version);
+       if (GIT_REPO_VERSION < repository_format_version)
+               die ("Expected git repo version <= %d, found %d",
+                    GIT_REPO_VERSION, repository_format_version);
+       return 0;
+}
+
 const char *setup_git_directory(void)
 {
        const char *retval = setup_git_directory_1();
+       check_repository_format();
        return retval;
 }