summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cache.h1
-rw-r--r--setup.c12
2 files changed, 12 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 0822c3b8be..f9e82a8ace 100644
--- a/cache.h
+++ b/cache.h
@@ -1099,6 +1099,7 @@ int split_cmdline(char *cmdline, const char ***argv);
/* git.c */
struct startup_info {
+ int have_repository;
};
extern struct startup_info *startup_info;
diff --git a/setup.c b/setup.c
index 2769160527..28a2b69d05 100644
--- a/setup.c
+++ b/setup.c
@@ -317,7 +317,7 @@ const char *read_gitfile_gently(const char *path)
* 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.
*/
-const char *setup_git_directory_gently(int *nongit_ok)
+static const char *setup_git_directory_gently_1(int *nongit_ok)
{
const char *work_tree_env = getenv(GIT_WORK_TREE_ENVIRONMENT);
const char *env_ceiling_dirs = getenv(CEILING_DIRECTORIES_ENVIRONMENT);
@@ -473,6 +473,16 @@ const char *setup_git_directory_gently(int *nongit_ok)
return cwd + offset;
}
+const char *setup_git_directory_gently(int *nongit_ok)
+{
+ const char *prefix;
+
+ prefix = setup_git_directory_gently_1(nongit_ok);
+ if (startup_info)
+ startup_info->have_repository = !nongit_ok || !*nongit_ok;
+ return prefix;
+}
+
int git_config_perm(const char *var, const char *value)
{
int i;