From: Junio C Hamano Date: Thu, 6 Dec 2007 01:49:13 +0000 (-0800) Subject: Merge branch 'maint' X-Git-Tag: v1.5.4-rc0~71 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=27ee189163070f53a87e033171a45520f70b242e;p=git.git Merge branch 'maint' * maint: git-am -i: report rewritten title git grep shows the same hit repeatedly for unmerged paths Do check_repository_format() early (re-fix) Do check_repository_format() early Add missing inside_work_tree setting in setup_git_directory_gently --- 27ee189163070f53a87e033171a45520f70b242e diff --cc setup.c index 2c7b5cb20,067f1be3f..e96a31645 --- a/setup.c +++ b/setup.c @@@ -206,22 -206,22 +206,38 @@@ static const char *set_work_tree(const return NULL; } +void setup_work_tree(void) +{ + const char *work_tree, *git_dir; + static int initialized = 0; + + if (initialized) + return; + work_tree = get_git_work_tree(); + git_dir = get_git_dir(); + if (!is_absolute_path(git_dir)) + set_git_dir(make_absolute_path(git_dir)); + if (!work_tree || chdir(work_tree)) + die("This operation must be run in a work tree"); + initialized = 1; +} + + static int check_repository_format_gently(int *nongit_ok) + { + git_config(check_repository_format_version); + if (GIT_REPO_VERSION < repository_format_version) { + if (!nongit_ok) + die ("Expected git repo version <= %d, found %d", + GIT_REPO_VERSION, repository_format_version); + warning("Expected git repo version <= %d, found %d", + GIT_REPO_VERSION, repository_format_version); + warning("Please upgrade Git"); + *nongit_ok = -1; + return -1; + } + return 0; + } + /* * We cannot decide in this function whether we are in the work tree or * not, since the config can only be read _after_ this function was called.