summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-10-26 13:14:44 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-10-26 13:14:44 -0700
commit1c2b1f7018ba7d5f6a5d949e29e4eaeeef3261e2 (patch)
tree680fa55e1b566665ffa45781e762b95a6635811f /environment.c
parentMerge branch 'js/libify-require-clean-work-tree' (diff)
parentls-files: add pathspec matching for submodules (diff)
downloadtgif-1c2b1f7018ba7d5f6a5d949e29e4eaeeef3261e2.tar.xz
Merge branch 'bw/ls-files-recurse-submodules'
"git ls-files" learned "--recurse-submodules" option that can be used to get a listing of tracked files across submodules (i.e. this only works with "--cached" option, not for listing untracked or ignored files). This would be a useful tool to sit on the upstream side of a pipe that is read with xargs to work on all working tree files from the top-level superproject. * bw/ls-files-recurse-submodules: ls-files: add pathspec matching for submodules ls-files: pass through safe options for --recurse-submodules ls-files: optionally recurse into submodules git: make super-prefix option
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/environment.c b/environment.c
index cd5aa57179..cdc097f80c 100644
--- a/environment.c
+++ b/environment.c
@@ -99,6 +99,8 @@ static char *work_tree;
static const char *namespace;
static size_t namespace_len;
+static const char *super_prefix;
+
static const char *git_dir, *git_common_dir;
static char *git_object_dir, *git_index_file, *git_graft_file;
int git_db_env, git_index_env, git_graft_env, git_common_dir_env;
@@ -119,6 +121,7 @@ const char * const local_repo_env[] = {
NO_REPLACE_OBJECTS_ENVIRONMENT,
GIT_REPLACE_REF_BASE_ENVIRONMENT,
GIT_PREFIX_ENVIRONMENT,
+ GIT_SUPER_PREFIX_ENVIRONMENT,
GIT_SHALLOW_FILE_ENVIRONMENT,
GIT_COMMON_DIR_ENVIRONMENT,
NULL
@@ -228,6 +231,16 @@ const char *strip_namespace(const char *namespaced_ref)
return namespaced_ref + namespace_len;
}
+const char *get_super_prefix(void)
+{
+ static int initialized;
+ if (!initialized) {
+ super_prefix = getenv(GIT_SUPER_PREFIX_ENVIRONMENT);
+ initialized = 1;
+ }
+ return super_prefix;
+}
+
static int git_work_tree_initialized;
/*