From: Stefan Beller <sbeller@google.com>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>,
Jeff King <peff@peff.net>,
Mark Strapetz <marc.strapetz@syntevo.com>,
Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH] git: submodule honor -c credential.* from command line
Date: Wed, 24 Feb 2016 15:27:30 -0800 [thread overview]
Message-ID: <CAGZ79kbSd4TRdgdcj2NUrc+pL7ATrGQNcfTYd57TuJtyZ5QBwg@mail.gmail.com> (raw)
In-Reply-To: <1456344559-2822-1-git-send-email-jacob.e.keller@intel.com>
On Wed, Feb 24, 2016 at 12:09 PM, Jacob Keller <jacob.e.keller@intel.com> wrote:
> From: Jacob Keller <jacob.keller@gmail.com>
>
> 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 which can be used to sanitize the
> GIT_CONFIG_PARAMETERS value to only allow certain settings. For now,
> restrict this to only credential.* settings.
I guess for now that subset is fine and will be expanded over time?
>
> 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.
The patch looks good to me, we should have introduced the submodule--helper
test file earlier. I may migrate the test for the fix I send earlier
today to that
file eventually.
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index f4c3eff179b5..8194d3b3d1d5 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -255,6 +255,56 @@ static int module_clone(int argc, const char **argv, const char *prefix)
> return 0;
> }
>
Probably this will cause easy to resolve merge conflicts with
origin/sb/submodule-parallel-update
> @@ -264,6 +314,7 @@ static struct cmd_struct commands[] = {
> {"list", module_list},
> {"name", module_name},
> {"clone", module_clone},
> + {"sanitize-config", module_sanitize_config},
same here.
> diff --git a/t/t7412-submodule--helper.sh b/t/t7412-submodule--helper.sh
> new file mode 100755
> index 000000000000..376f58afe967
> --- /dev/null
> +++ b/t/t7412-submodule--helper.sh
Thanks for introducing such a file. I did not do it as I though it was
"too small"
and would not be enough to test to justify its own file.
> +
> +test_expect_success 'sanitize-config clears configuration' '
> + git -c user.name="Some User" submodule--helper sanitize-config >actual &&
> + test_must_be_empty actual
I usually keep my user.name in the global config, so no need to pass
it around like that,
but for testing purposes this looks good.
next prev parent reply other threads:[~2016-02-24 23:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 20:09 [PATCH] git: submodule honor -c credential.* from command line Jacob Keller
2016-02-24 23:27 ` Stefan Beller [this message]
2016-02-24 23:36 ` Junio C Hamano
2016-02-24 23:51 ` Jacob Keller
2016-02-25 0:43 ` Junio C Hamano
2016-02-24 23:50 ` Jacob Keller
-- strict thread matches above, loose matches on Subject: below --
2016-02-24 23:12 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=CAGZ79kbSd4TRdgdcj2NUrc+pL7ATrGQNcfTYd57TuJtyZ5QBwg@mail.gmail.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=marc.strapetz@syntevo.com \
--cc=peff@peff.net \
/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).