aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-03-25 14:00:44 -0700
committerJunio C Hamano <gitster@pobox.com>2013-03-25 14:00:44 -0700
commitfb3b7b1f95ce3c39f1116ebabf0bbcbfd3bb8796 (patch)
treea56b7339ad8c0877ee6d6fae25dba8caf58c8518 /cache.h
parent55f6fbef3d3910fbc5de87f81e8e8e882d3d1d38 (diff)
parent2cd83d10bb6bcf768129e1c4e5a4dee4b6bcd27f (diff)
downloadgit-fb3b7b1f95ce3c39f1116ebabf0bbcbfd3bb8796.tar.gz
git-fb3b7b1f95ce3c39f1116ebabf0bbcbfd3bb8796.tar.xz
Merge branch 'jk/alias-in-bare'
An aliased command spawned from a bare repository that does not say it is bare with "core.bare = yes" is treated as non-bare by mistake. * jk/alias-in-bare: setup: suppress implicit "." work-tree for bare repos environment: add GIT_PREFIX to local_repo_env cache.h: drop LOCAL_REPO_ENV_SIZE
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h25
1 files changed, 19 insertions, 6 deletions
diff --git a/cache.h b/cache.h
index c56315ccc..fc5c5b573 100644
--- a/cache.h
+++ b/cache.h
@@ -341,9 +341,11 @@ static inline enum object_type object_type(unsigned int mode)
OBJ_BLOB;
}
+/* Double-check local_repo_env below if you add to this list. */
#define GIT_DIR_ENVIRONMENT "GIT_DIR"
#define GIT_NAMESPACE_ENVIRONMENT "GIT_NAMESPACE"
#define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE"
+#define GIT_PREFIX_ENVIRONMENT "GIT_PREFIX"
#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
@@ -365,13 +367,24 @@ static inline enum object_type object_type(unsigned int mode)
#define GIT_LITERAL_PATHSPECS_ENVIRONMENT "GIT_LITERAL_PATHSPECS"
/*
- * Repository-local GIT_* environment variables
- * The array is NULL-terminated to simplify its usage in contexts such
- * environment creation or simple walk of the list.
- * The number of non-NULL entries is available as a macro.
+ * This environment variable is expected to contain a boolean indicating
+ * whether we should or should not treat:
+ *
+ * GIT_DIR=foo.git git ...
+ *
+ * as if GIT_WORK_TREE=. was given. It's not expected that users will make use
+ * of this, but we use it internally to communicate to sub-processes that we
+ * are in a bare repo. If not set, defaults to true.
+ */
+#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT "GIT_IMPLICIT_WORK_TREE"
+
+/*
+ * Repository-local GIT_* environment variables; these will be cleared
+ * when git spawns a sub-process that runs inside another repository.
+ * The array is NULL-terminated, which makes it easy to pass in the "env"
+ * parameter of a run-command invocation, or to do a simple walk.
*/
-#define LOCAL_REPO_ENV_SIZE 9
-extern const char *const local_repo_env[LOCAL_REPO_ENV_SIZE + 1];
+extern const char * const local_repo_env[];
extern int is_bare_repository_cfg;
extern int is_bare_repository(void);