Subject: Re: [PATCH v6 7/7] git: submodule honor -c credential.* from command line

From: Jonathan Nieder <[email-masked]>
Date: Tue, 22 Mar 2016 11:56:28 -0700

Hi,

Jacob Keller wrote:

> Due to the way that the git-submodule code works, it clears all local
> git environment variables before entering submodules. This is normally
> a good thing since we want to clear settings such as GIT_WORKTREE and
> other variables which would affect the operation of submodule commands.
> However, GIT_CONFIG_PARAMETERS is special, and we actually do want to
> preserve these settings. However, we do not want to preserve all
> configuration as many things should be left specific to the parent
> project.
>
> Add a git submodule--helper function, sanitize-config, which shall be
> used to sanitize GIT_CONFIG_PARAMETERS, removing all key/value pairs
> except a small subset that are known to be safe and necessary.
>
> Replace all the calls to clear_local_git_env with a wrapped function
> that filters GIT_CONFIG_PARAMETERS using the new helper and then
> restores it to the filtered subset after clearing the rest of the
> environment.

This is failing for me when I use "git submodule add" with a remote
helper I whitelisted with GIT_ALLOW_PROTOCOL, with current "next":

 $ bin-wrappers/git submodule add persistent-https://kernel.googlesource.com/pub/scm/git/git sm
 Cloning into 'sm'...
 error: bogus format in GIT_CONFIG_PARAMETERS
 fatal: unable to parse command-line config
 fatal: clone of 'persistent-https://kernel.googlesource.com/pub/scm/git/git' into submodule path 'sm' failed

sq_dequote_to_argv doesn't like the space at the beginning of
$GIT_CONFIG_PARAMETERS.  Reverting 14111fc4 fixes it.  Known
problem?

Thanks,
Jonathan