diff options
| author | Junio C Hamano <junkio@cox.net> | 2007-01-11 16:50:36 -0800 |
|---|---|---|
| committer | Junio C Hamano <junkio@cox.net> | 2007-01-11 16:50:36 -0800 |
| commit | e861ce1692fa9809f3e7b898804f8ddaf7cd8975 (patch) | |
| tree | 1d812c3d71bab1fcf45fa09f03da21cd01c985ba /environment.c | |
| parent | 141d21b8256ef96bbd693fd35e154787365e26dc (diff) | |
| parent | 7eff28a9b42cb0d3aad932338b2e645fc6ed8fa9 (diff) | |
| download | git-e861ce1692fa9809f3e7b898804f8ddaf7cd8975.tar.gz | |
Merge branch 'jc/bare'
* jc/bare:
Disallow working directory commands in a bare repository.
git-fetch: allow updating the current branch in a bare repository.
Introduce is_bare_repository() and core.bare configuration variable
Move initialization of log_all_ref_updates
Diffstat (limited to 'environment.c')
| -rw-r--r-- | environment.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/environment.c b/environment.c index 09976c7bf6..54c22f8248 100644 --- a/environment.c +++ b/environment.c @@ -15,7 +15,8 @@ int use_legacy_headers = 1; int trust_executable_bit = 1; int assume_unchanged; int prefer_symlink_refs; -int log_all_ref_updates; +int is_bare_repository_cfg = -1; /* unspecified */ +int log_all_ref_updates = -1; /* unspecified */ int warn_ambiguous_refs = 1; int repository_format_version; char *git_commit_encoding; @@ -51,12 +52,15 @@ static void setup_git_env(void) git_graft_file = getenv(GRAFT_ENVIRONMENT); if (!git_graft_file) git_graft_file = xstrdup(git_path("info/grafts")); - log_all_ref_updates = !is_bare_git_dir(git_dir); } -int is_bare_git_dir (const char *dir) +int is_bare_repository(void) { - const char *s; + const char *dir, *s; + if (0 <= is_bare_repository_cfg) + return is_bare_repository_cfg; + + dir = get_git_dir(); if (!strcmp(dir, DEFAULT_GIT_DIR_ENVIRONMENT)) return 0; s = strrchr(dir, '/'); |
