From: Jeff King <peff@peff.net>
To: Jacob Keller <jacob.keller@gmail.com>
Cc: Marc Strapetz <marc.strapetz@syntevo.com>,
Jens Lehmann <Jens.Lehmann@web.de>,
Git mailing list <git@vger.kernel.org>
Subject: Re: git submodule should honor "-c credential.helper" command line argument
Date: Fri, 19 Feb 2016 02:46:33 -0500 [thread overview]
Message-ID: <20160219074633.GA780@sigill.intra.peff.net> (raw)
In-Reply-To: <CA+P7+xr9dLOyaVky1jvXm7MkF0JUqs5SadrTdr4o83baMp397A@mail.gmail.com>
On Thu, Feb 18, 2016 at 11:29:09PM -0800, Jacob Keller wrote:
> I would prefer to either.. blacklist stuff like core.worktree, or
> whitelist a bunch of stuff that makes sense. In this case though, I
> would prefer to have an explicit test of credential.helper, but I
> don't know if any of our tests actually have a solid test case for
> "credential.helper was used in a clone. There may not be test
> infrastructure for this though, so your test might work well enough.
To trigger a credential fetch in actual use, you have to clone over
http. See the credential tests in t5550, for example.
> As for how to whitelist config to share with the submodule I am really
> not 100% sure, since we just clear GIT_CONFIG_PARAMETERS, and I think
> we'd need a specialized variant of clear_local_git_env_vars specific
> to submodule then.
Yeah, you'll have to parse, which is pretty painful. In C, you'd do
something like:
int submodule_config_ok(const char *var)
{
if (starts_with(var, "credential."))
return 1;
return 0;
}
int filter_submodule_config(const char *var, const char *value, void *data)
{
struct strbuf *out = data;
if (submodule_config_ok(var)) {
if (out->len)
strbuf_addch(out, ' ');
/* these actually probably need quoted all as * one string */
sq_quote_buf(out, var);
sq_quote_buf(out, "=");
sq_quote_buf(out, value);
}
return 0;
}
and then call it like:
struct strbuf filtered_config = STRBUF_INIT;
git_config_from_parameters(filter_submodule_config, &filtered_config);
argv_array_pushf(&child_process.env, "%s=%s",
CONFIG_DATA_ENVIRONMENT, filtered_config.buf);
but right now git-submodule.sh is all in shell. You'd probably need a
special helper from git-submodule--helper, though it might simply make
sense to put this off until the submodule code is fully ported to C.
-Peff
next prev parent reply other threads:[~2016-02-19 7:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-02 17:13 git submodule should honor "-c credential.helper" command line argument Marc Strapetz
2016-02-03 4:25 ` Jeff King
2016-02-03 7:35 ` Jacob Keller
2016-02-03 8:08 ` Marc Strapetz
2016-02-03 23:44 ` Jacob Keller
2016-02-07 4:41 ` Jacob Keller
2016-02-07 13:48 ` Marc Strapetz
2016-02-08 3:44 ` Jacob Keller
2016-02-19 1:15 ` Jacob Keller
2016-02-19 4:30 ` Jeff King
2016-02-19 7:29 ` Jacob Keller
2016-02-19 7:46 ` Jeff King [this message]
2016-02-19 7:51 ` Jacob Keller
2016-02-19 17:33 ` Junio C Hamano
2016-02-19 19:34 ` 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=20160219074633.GA780@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=Jens.Lehmann@web.de \
--cc=git@vger.kernel.org \
--cc=jacob.keller@gmail.com \
--cc=marc.strapetz@syntevo.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).