From: Jeff King <peff@peff.net>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
Git mailing list <git@vger.kernel.org>,
Mark Strapetz <marc.strapetz@syntevo.com>,
Stefan Beller <sbeller@google.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2] git: submodule honor -c credential.* from command line
Date: Thu, 25 Feb 2016 02:11:59 -0500 [thread overview]
Message-ID: <20160225071159.GA22529@sigill.intra.peff.net> (raw)
In-Reply-To: <20160225070036.GA5654@sigill.intra.peff.net>
On Thu, Feb 25, 2016 at 02:00:36AM -0500, Jeff King wrote:
> I think something like this would work:
> [...]
> but it does not seem to pass with your patch (even after I fixed up the
> weird "local" thing). I think the problem is that we ask
> submodule--helper to do the clone, and it uses local_repo_env. So in
> addition to your patch, you probably need a C version of the same thing
> which outputs to an argv_array.
Something like this (which passes my test, but I didn't think hard about
it beyond that):
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 8b3320e..fa941fd 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -124,6 +124,27 @@ static int module_name(int argc, const char **argv, const char *prefix)
return 0;
}
+
+/* this (and submodule_config_ok) should be static in the original */
+int sanitize_submodule_config(const char *, const char *, void *);
+
+static void add_submodule_repo_env(struct argv_array *out)
+{
+ const char * const *var;
+
+ for (var = local_repo_env; *var; var++) {
+ if (!strcmp(*var, CONFIG_DATA_ENVIRONMENT)) {
+ struct strbuf sanitized_config = STRBUF_INIT;
+ git_config_from_parameters(sanitize_submodule_config,
+ &sanitized_config);
+ argv_array_pushf(out, "%s=%s", *var, sanitized_config.buf);
+ strbuf_release(&sanitized_config);
+ } else {
+ argv_array_push(out, *var);
+ }
+ }
+}
+
static int clone_submodule(const char *path, const char *gitdir, const char *url,
const char *depth, const char *reference, int quiet)
{
@@ -145,7 +166,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
argv_array_push(&cp.args, path);
cp.git_cmd = 1;
- cp.env = local_repo_env;
+ add_submodule_repo_env(&cp.env_array);
cp.no_stdin = 1;
return run_command(&cp);
next prev parent reply other threads:[~2016-02-25 7:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 23:59 [PATCH v2] git: submodule honor -c credential.* from command line Jacob Keller
2016-02-25 0:27 ` Eric Sunshine
2016-02-25 1:45 ` Jeff King
2016-02-25 6:19 ` Jacob Keller
2016-02-25 6:23 ` Jeff King
2016-02-25 6:24 ` Jacob Keller
2016-02-25 1:41 ` Jeff King
2016-02-25 6:23 ` Jacob Keller
2016-02-25 7:00 ` Jeff King
2016-02-25 7:11 ` Jeff King [this message]
2016-02-25 18:07 ` Jacob Keller
2016-02-25 18:51 ` Jacob Keller
2016-02-25 20:32 ` Junio C Hamano
2016-02-25 21:48 ` Jacob Keller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160225071159.GA22529@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=marc.strapetz@syntevo.com \
--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.
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 NNTP newsgroup(s).