From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: Brandon Williams <bmwill@google.com>,
sbeller@google.com, gitster@pobox.com, peff@peff.net,
johannes.schindelin@gmx.de, pclouds@gmail.com
Subject: [PATCH v2 2/4] setup: allow for prefix to be passed to git commands
Date: Tue, 14 Mar 2017 15:10:58 -0700 [thread overview]
Message-ID: <20170314221100.24856-3-bmwill@google.com> (raw)
In-Reply-To: <20170314221100.24856-1-bmwill@google.com>
In a future patch child processes which act on submodules need a little
more context about the original command that was invoked. This patch
teaches git to use the prefix stored in `GIT_INTERNAL_TOPLEVEL_PREFIX`
if another prefix wasn't found during the git directory setup process.
---
cache.h | 1 +
git.c | 2 --
setup.c | 6 ++++++
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/cache.h b/cache.h
index 8c0e64420..7d253a078 100644
--- a/cache.h
+++ b/cache.h
@@ -410,6 +410,7 @@ static inline enum object_type object_type(unsigned int mode)
#define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE"
#define GIT_PREFIX_ENVIRONMENT "GIT_PREFIX"
#define GIT_SUPER_PREFIX_ENVIRONMENT "GIT_INTERNAL_SUPER_PREFIX"
+#define GIT_TOPLEVEL_PREFIX_ENVIRONMENT "GIT_INTERNAL_TOPLEVEL_PREFIX"
#define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
#define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
#define INDEX_ENVIRONMENT "GIT_INDEX_FILE"
diff --git a/git.c b/git.c
index 33f52acbc..8ff44f081 100644
--- a/git.c
+++ b/git.c
@@ -361,8 +361,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
if (!help && get_super_prefix()) {
if (!(p->option & SUPPORT_SUPER_PREFIX))
die("%s doesn't support --super-prefix", p->cmd);
- if (prefix)
- die("can't use --super-prefix from a subdirectory");
}
if (!help && p->option & NEED_WORK_TREE)
diff --git a/setup.c b/setup.c
index 8f64fbdfb..c8492ea8a 100644
--- a/setup.c
+++ b/setup.c
@@ -940,8 +940,14 @@ static const char *setup_git_directory_gently_1(int *nongit_ok)
const char *setup_git_directory_gently(int *nongit_ok)
{
const char *prefix;
+ const char *env_prefix;
prefix = setup_git_directory_gently_1(nongit_ok);
+ env_prefix = getenv(GIT_TOPLEVEL_PREFIX_ENVIRONMENT);
+
+ if (env_prefix)
+ prefix = env_prefix;
+
if (prefix)
setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1);
else
--
2.12.0.367.g23dc2f6d3c-goog
next prev parent reply other threads:[~2017-03-14 22:11 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 23:50 [PATCH 0/5] recursing submodules with relative pathspec (grep and ls-files) Brandon Williams
2017-02-24 23:50 ` [PATCH 1/5] grep: illustrate bug when recursing with relative pathspec Brandon Williams
2017-02-26 9:53 ` Duy Nguyen
2017-02-27 18:14 ` Brandon Williams
2017-02-24 23:50 ` [PATCH 2/5] pathspec: add PATHSPEC_FROMROOT flag Brandon Williams
2017-02-25 0:31 ` Stefan Beller
2017-02-24 23:50 ` [PATCH 3/5] grep: fix bug when recuring with relative pathspec Brandon Williams
2017-02-28 21:04 ` Junio C Hamano
2017-03-02 18:00 ` Brandon Williams
2017-02-24 23:50 ` [PATCH 4/5] ls-files: illustrate bug when recursing " Brandon Williams
2017-02-24 23:51 ` [PATCH 5/5] ls-files: fix bug when recuring " Brandon Williams
2017-02-28 21:07 ` Junio C Hamano
2017-03-02 18:01 ` Brandon Williams
2017-02-27 17:52 ` [PATCH 0/5] recursing submodules with relative pathspec (grep and ls-files) Brandon Williams
2017-03-06 23:07 ` [RFC PATCH] grep: fix bug when recursing with relative pathspec Brandon Williams
2017-03-14 22:10 ` [PATCH v2 0/4] recursing submodules with relative pathspec (grep and ls-files) Brandon Williams
2017-03-14 22:10 ` [PATCH v2 1/4] grep: fix help text typo Brandon Williams
2017-03-14 22:49 ` Stefan Beller
2017-03-15 0:20 ` Brandon Williams
2017-03-14 22:10 ` Brandon Williams [this message]
2017-03-14 22:28 ` [PATCH v2 2/4] setup: allow for prefix to be passed to git commands Johannes Schindelin
2017-03-14 22:35 ` Brandon Williams
2017-03-14 22:10 ` [PATCH v2 3/4] grep: fix bug when recursing with relative pathspec Brandon Williams
2017-03-14 23:03 ` Stefan Beller
2017-03-14 22:11 ` [PATCH v2 4/4] ls-files: " Brandon Williams
2017-03-14 23:06 ` Stefan Beller
2017-03-15 17:02 ` Brandon Williams
2017-03-17 17:22 ` [PATCH v3 0/5] recursing submodules with relative pathspec (grep and ls-files) Brandon Williams
2017-03-17 17:22 ` [PATCH v3 1/5] grep: fix help text typo Brandon Williams
2017-03-17 17:22 ` [PATCH v3 2/5] setup: allow for prefix to be passed to git commands Brandon Williams
2017-03-17 19:07 ` Stefan Beller
2017-03-17 19:08 ` Brandon Williams
2017-03-17 19:10 ` Stefan Beller
2017-03-17 19:17 ` Brandon Williams
2017-03-17 19:17 ` Junio C Hamano
2017-03-17 19:21 ` Brandon Williams
2017-03-17 20:30 ` Junio C Hamano
2017-03-17 21:00 ` Brandon Williams
2017-03-17 21:25 ` Junio C Hamano
2017-03-20 22:34 ` Brandon Williams
2017-03-21 16:56 ` Junio C Hamano
2017-03-28 23:58 ` Stefan Beller
2017-03-17 17:22 ` [PATCH v3 3/5] grep: fix bug when recursing with relative pathspec Brandon Williams
2017-03-21 11:47 ` Duy Nguyen
2017-03-21 17:56 ` Junio C Hamano
2017-03-22 21:46 ` Brandon Williams
2017-03-17 17:22 ` [PATCH v3 4/5] ls-files: fix typo in variable name Brandon Williams
2017-03-17 17:22 ` [PATCH v3 5/5] ls-files: fix bug when recursing with relative pathspec Brandon Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170314221100.24856-3-bmwill@google.com \
--to=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=pclouds@gmail.com \
--cc=peff@peff.net \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).