Re: [RFC] How to pass Git config command line instructions to Submodule commands?
- From
Jeff King <peff@peff.net>
- Date
- Apr 28, 2016, 11:25 UTC
- Message-ID
- <20160428112511.GA11522@sigill.intra.peff.net>
- In-Reply-To
- <017AA7DB-5224-49C3-A4A6-6C93005BF006@gmail.com>
On Thu, Apr 28, 2016 at 01:06:45PM +0200, Lars Schneider wrote:
Show 6 quoted lines
> I got my Git-LFS use case working with the patch below. > For me it was necessary to export GIT_CONFIG_PARAMETERS > to make it available to the Git process if the process is > invoked as follows [2]: > > (sanitize_submodule_env; cd "$sm_path" && git <something>")
Hrm. I'm not sure why you need to export. Or perhaps, I am not sure why it ever works in the first place in git-submodule.sh. In this code:
Show 11 quoted lines
> diff --git a/git-submodule.sh b/git-submodule.sh
> index 2a84d7e..b02f5b9 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -199,7 +199,7 @@ sanitize_submodule_env()
> {
> sanitized_config=$(git submodule--helper sanitize-config)
> clear_local_git_env
> - GIT_CONFIG_PARAMETERS=$sanitized_config
> + export GIT_CONFIG_PARAMETERS=$sanitized_config
> }If you already have $GIT_CONFIG_PARAMETERS exported when we enter the function, then we should not need to re-export it when changing the value in the final line (the export bit is retained by the shell). But if you don't have it set already, then $sanitized_config must by definition be empty.
So it should do the right thing without the export.
At the same time, clear_local_git_env() will call "unset" on GIT_CONFIG_PARAMETERS. Which would clear the export bit, meaning the final line doesn't ever have any impact on sub-programs, and the whole thing is totally broken. But then, why does the test in t5550 pass?
Confused...
-Peff