mirror of
https://github.com/git/git
synced 2024-08-27 19:49:21 +00:00
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>
This commit is contained in:
parent
51b3c00e9d
commit
ab9cb76f66
5
cache.h
5
cache.h
|
@ -182,6 +182,10 @@ extern int trust_executable_bit;
|
||||||
extern int only_use_symrefs;
|
extern int only_use_symrefs;
|
||||||
extern int diff_rename_limit_default;
|
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 MTIME_CHANGED 0x0001
|
||||||
#define CTIME_CHANGED 0x0002
|
#define CTIME_CHANGED 0x0002
|
||||||
#define OWNER_CHANGED 0x0004
|
#define OWNER_CHANGED 0x0004
|
||||||
|
@ -388,6 +392,7 @@ extern int git_config_int(const char *, const char *);
|
||||||
extern int git_config_bool(const char *, const char *);
|
extern int git_config_bool(const char *, const char *);
|
||||||
extern int git_config_set(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 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)
|
#define MAX_GITNAME (1000)
|
||||||
extern char git_default_email[MAX_GITNAME];
|
extern char git_default_email[MAX_GITNAME];
|
||||||
|
|
|
@ -13,6 +13,7 @@ char git_default_email[MAX_GITNAME];
|
||||||
char git_default_name[MAX_GITNAME];
|
char git_default_name[MAX_GITNAME];
|
||||||
int trust_executable_bit = 1;
|
int trust_executable_bit = 1;
|
||||||
int only_use_symrefs = 0;
|
int only_use_symrefs = 0;
|
||||||
|
int repository_format_version = 0;
|
||||||
|
|
||||||
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
|
static char *git_dir, *git_object_dir, *git_index_file, *git_refs_dir,
|
||||||
*git_graft_file;
|
*git_graft_file;
|
||||||
|
|
16
setup.c
16
setup.c
|
@ -154,6 +154,22 @@ static const char *setup_git_directory_1(void)
|
||||||
return cwd + offset;
|
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 *setup_git_directory(void)
|
||||||
{
|
{
|
||||||
const char *retval = setup_git_directory_1();
|
const char *retval = setup_git_directory_1();
|
||||||
|
|
Loading…
Reference in a new issue