summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51b3c00)
raw | patch | inline | side by side (parent: 51b3c00)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 25 Nov 2005 23:59:09 +0000 (15:59 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 27 Nov 2005 09:32:59 +0000 (01:32 -0800) |
This adds the repository format version code, first done by
Martin Atukunda.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Martin Atukunda.
Signed-off-by: Junio C Hamano <junkio@cox.net>
cache.h | patch | blob | history | |
environment.c | patch | blob | history | |
setup.c | patch | blob | history |
index 6ac94c5a1f0ccdc956b006eaa9a176835f5726fb..de53f41287419a53e8f7b3c7669316dca6571d7e 100644 (file)
--- a/cache.h
+++ b/cache.h
extern int only_use_symrefs;
extern int diff_rename_limit_default;
+#define GIT_REPO_VERSION 0
+extern int repository_format_version;
+extern int check_repository_format(void);
+
#define MTIME_CHANGED 0x0001
#define CTIME_CHANGED 0x0002
#define OWNER_CHANGED 0x0004
extern int git_config_bool(const char *, const char *);
extern int git_config_set(const char *, const char *);
extern int git_config_set_multivar(const char *, const char *, const char *, int);
+extern int check_repository_format_version(const char *var, const char *value);
#define MAX_GITNAME (1000)
extern char git_default_email[MAX_GITNAME];
diff --git a/environment.c b/environment.c
index b5026f1265b771bc3f9906507b015fbd1d68f8fb..3f194732e539918413277dbfda6e11924eda43bb 100644 (file)
--- a/environment.c
+++ b/environment.c
char git_default_name[MAX_GITNAME];
int trust_executable_bit = 1;
int only_use_symrefs = 0;
+int repository_format_version = 0;
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
*git_graft_file;
index ab3c778e805c166446d05c27617552da0f951f8c..0e2e3c8c3c49ccf2aaac6c9569e8260eafbbd491 100644 (file)
--- a/setup.c
+++ b/setup.c
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();