git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git submodule should honor "-c credential.helper" command line argument

From
Jeff King <peff@peff.net>
Date
Feb 19, 2016, 07:46 UTC
Message-ID
<20160219074633.GA780@sigill.intra.peff.net>
In-Reply-To
<CA+P7+xr9dLOyaVky1jvXm7MkF0JUqs5SadrTdr4o83baMp397A@mail.gmail.com>
On Thu, Feb 18, 2016 at 11:29:09PM -0800, Jacob Keller wrote:
Show 6 quoted lines
> 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
Previous: Jacob KellerNext: Jacob Keller
Message 12 of 15 in “git submodule should honor "-c credential.helper" command line argument”
  1. Marc StrapetzFeb 2, 2016
  2. Jeff KingFeb 3, 2016
  3. Jacob KellerFeb 3, 2016
  4. Marc StrapetzFeb 3, 2016
  5. Jacob KellerFeb 3, 2016
  6. Jacob KellerFeb 7, 2016
  7. Marc StrapetzFeb 7, 2016
  8. Jacob KellerFeb 8, 2016
  9. Jacob KellerFeb 19, 2016
  10. Jeff KingFeb 19, 2016
  11. Jacob KellerFeb 19, 2016
  12. Jeff KingFeb 19, 2016
  13. Jacob KellerFeb 19, 2016
  14. Junio C HamanoFeb 19, 2016
  15. Jacob KellerFeb 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.