# submodule update and core.askpass

4 messages from 2013-11-16 to 2013-11-22. Participants: Dmitry Neverov, Thomas Rast, Jens Lehmann.
Thread: https://gitlist.dev/t/35348

## Dmitry Neverov, 2013-11-16 21:24

Subject: submodule update and core.askpass
Message-ID: <m28uwoxcoh.fsf@nds-macbook-air.labs.intellij.net>
URL: https://gitlist.dev/e/m28uwoxcoh.fsf%40nds-macbook-air.labs.intellij.net

```
Hi,

it seems like "git submodule update" command doesn't respect the
core.askpass option specified in a command line. I have a repository
with a submodule, I serve it over http which requires an authorization
and both main repository and submodule require the same credentials. I
run the following commands (pass.sh is a script which prints a password
to stdout):

git -c core.askpass=pass.sh clone main-repo
cd main-repo
git submodule init
git submodule sync
git -c core.askpass=pass.sh submodule update

The last command asks for a password interactively. 

I've run bisect, it seems like it started failing from commit
be8779f7ac9a3be9aa783df008d59082f4054f67. I've checked: submodule update
works fine in 1.8.5.rc2 with removed call to clear_local_git_env.

Is there any way to make git submodule update respect core.askpass
option, so one can use it in scripts?

-- 
Dmitry Neverov

```

## Thomas Rast, 2013-11-16 21:42

Subject: Re: submodule update and core.askpass
Message-ID: <87eh6gkoq9.fsf@linux-k42r.v.cablecom.net>
URL: https://gitlist.dev/e/87eh6gkoq9.fsf%40linux-k42r.v.cablecom.net
In-Reply-To: <m28uwoxcoh.fsf@nds-macbook-air.labs.intellij.net>

```
+cc Daniel and Jens

Dmitry Neverov <dmitry.neverov@jetbrains.com> writes:

> git -c core.askpass=pass.sh clone main-repo
> cd main-repo
> git submodule init
> git submodule sync
> git -c core.askpass=pass.sh submodule update
>
> The last command asks for a password interactively. 
>
> I've run bisect, it seems like it started failing from commit
> be8779f7ac9a3be9aa783df008d59082f4054f67. I've checked: submodule update
> works fine in 1.8.5.rc2 with removed call to clear_local_git_env.

Aside from GIT_CONFIG_PARAMETERS, which this needs, I wonder if we
should also let other variables pass through.  For example, if the user
went out of their way to set GIT_ALTERNATE_OBJECT_DIRECTORIES, shouldn't
we also respect that?

The list of variables that is unset by clear_local_git_env is $(git
rev-parse --local-env-vars), currently

  GIT_ALTERNATE_OBJECT_DIRECTORIES
  GIT_CONFIG
  GIT_CONFIG_PARAMETERS
  GIT_OBJECT_DIRECTORY
  GIT_DIR
  GIT_WORK_TREE
  GIT_IMPLICIT_WORK_TREE
  GIT_GRAFT_FILE
  GIT_INDEX_FILE
  GIT_NO_REPLACE_OBJECTS
  GIT_PREFIX

-- 
Thomas Rast
tr@thomasrast.ch

```

## Jens Lehmann, 2013-11-16 22:39

Subject: Re: submodule update and core.askpass
Message-ID: <5287F42D.5090900@web.de>
URL: https://gitlist.dev/e/5287F42D.5090900%40web.de
In-Reply-To: <87eh6gkoq9.fsf@linux-k42r.v.cablecom.net>

```
Am 16.11.2013 22:42, schrieb Thomas Rast:
> Dmitry Neverov <dmitry.neverov@jetbrains.com> writes:
> 
>> git -c core.askpass=pass.sh clone main-repo
>> cd main-repo
>> git submodule init
>> git submodule sync
>> git -c core.askpass=pass.sh submodule update
>>
>> The last command asks for a password interactively. 
>>
>> I've run bisect, it seems like it started failing from commit
>> be8779f7ac9a3be9aa783df008d59082f4054f67. I've checked: submodule update
>> works fine in 1.8.5.rc2 with removed call to clear_local_git_env.
> 
> Aside from GIT_CONFIG_PARAMETERS, which this needs ...

Yes, if I understand GIT_CONFIG_PARAMETERS correctly we should not
clean it as the user explicitly asked us to use that setting.

> ..., I wonder if we
> should also let other variables pass through.  For example, if the user
> went out of their way to set GIT_ALTERNATE_OBJECT_DIRECTORIES, shouldn't
> we also respect that?

Hmm, I'm not so sure. Does the user really want the setting of
GIT_ALTERNATE_OBJECT_DIRECTORIES to be honored inside the submodule
too or would he want a different setting (including none)? I suspect
different users would give different answers. And wouldn't a working
GIT_CONFIG_PARAMETERS (or configuring the submodule after the initial
clone) be the solution for that?

> The list of variables that is unset by clear_local_git_env is $(git
> rev-parse --local-env-vars), currently
> 
>   GIT_ALTERNATE_OBJECT_DIRECTORIES
>   GIT_CONFIG
>   GIT_CONFIG_PARAMETERS
>   GIT_OBJECT_DIRECTORY
>   GIT_DIR
>   GIT_WORK_TREE
>   GIT_IMPLICIT_WORK_TREE
>   GIT_GRAFT_FILE
>   GIT_INDEX_FILE
>   GIT_NO_REPLACE_OBJECTS
>   GIT_PREFIX

```

## Dmitry Neverov, 2013-11-22 12:33

Subject: Re: submodule update and core.askpass
Message-ID: <m2wqk0zkd3.fsf@nds-macbook-air.labs.intellij.net>
URL: https://gitlist.dev/e/m2wqk0zkd3.fsf%40nds-macbook-air.labs.intellij.net
In-Reply-To: <5287F42D.5090900@web.de>

```
BTW, a workaround is to pass a path to askpass script in the GIT_ASKPASS
environment variable. 
Jens Lehmann <Jens.Lehmann@web.de> writes:

> Am 16.11.2013 22:42, schrieb Thomas Rast:
>> Dmitry Neverov <dmitry.neverov@jetbrains.com> writes:
>> 
>>> git -c core.askpass=pass.sh clone main-repo
>>> cd main-repo
>>> git submodule init
>>> git submodule sync
>>> git -c core.askpass=pass.sh submodule update
>>>
>>> The last command asks for a password interactively. 
>>>
>>> I've run bisect, it seems like it started failing from commit
>>> be8779f7ac9a3be9aa783df008d59082f4054f67. I've checked: submodule update
>>> works fine in 1.8.5.rc2 with removed call to clear_local_git_env.
>> 
>> Aside from GIT_CONFIG_PARAMETERS, which this needs ...
>
> Yes, if I understand GIT_CONFIG_PARAMETERS correctly we should not
> clean it as the user explicitly asked us to use that setting.
>
>> ..., I wonder if we
>> should also let other variables pass through.  For example, if the user
>> went out of their way to set GIT_ALTERNATE_OBJECT_DIRECTORIES, shouldn't
>> we also respect that?
>
> Hmm, I'm not so sure. Does the user really want the setting of
> GIT_ALTERNATE_OBJECT_DIRECTORIES to be honored inside the submodule
> too or would he want a different setting (including none)? I suspect
> different users would give different answers. And wouldn't a working
> GIT_CONFIG_PARAMETERS (or configuring the submodule after the initial
> clone) be the solution for that?
>
>> The list of variables that is unset by clear_local_git_env is $(git
>> rev-parse --local-env-vars), currently
>> 
>>   GIT_ALTERNATE_OBJECT_DIRECTORIES
>>   GIT_CONFIG
>>   GIT_CONFIG_PARAMETERS
>>   GIT_OBJECT_DIRECTORY
>>   GIT_DIR
>>   GIT_WORK_TREE
>>   GIT_IMPLICIT_WORK_TREE
>>   GIT_GRAFT_FILE
>>   GIT_INDEX_FILE
>>   GIT_NO_REPLACE_OBJECTS
>>   GIT_PREFIX
>
>

-- 
Dmitry Neverov
JetBrains
http://www.jetbrains.com
"Develop with pleasure!"

```
