summaryrefslogtreecommitdiff
path: root/setup.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-25 23:59:09 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-27 09:32:59 (GMT)
commitab9cb76f661c1794800361c27bc5a515245aaaef (patch)
treed13942115e4692463908c41efe7d2d7369a63d52 /setup.c
parent51b3c00e9d95371a9ad202204f01c5981f241b20 (diff)
downloadgit-ab9cb76f661c1794800361c27bc5a515245aaaef.zip
git-ab9cb76f661c1794800361c27bc5a515245aaaef.tar.gz
git-ab9cb76f661c1794800361c27bc5a515245aaaef.tar.bz2
Repository format version check.
This adds the repository format version code, first done by Martin Atukunda. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'setup.c')
-rw-r--r--setup.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/setup.c b/setup.c
index ab3c778..0e2e3c8 100644
--- a/setup.c
+++ b/setup.c
@@ -154,6 +154,22 @@ 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();