Re: [PATCH v2] git: submodule honor -c credential.* from command line

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH v2] git: submodule honor -c credential.* from command line

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:08:28

Jacob Keller [off-list ref] writes:
On Wed, Feb 24, 2016 at 11:11 PM, Jeff King [off-list ref] wrote:
quoted
 static int clone_submodule(const char *path, const char *gitdir, const char *url,
                           const char *depth, const char *reference, int quiet)
 {
@@ -145,7 +166,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
        argv_array_push(&cp.args, path);

        cp.git_cmd = 1;
-       cp.env = local_repo_env;
+       add_submodule_repo_env(&cp.env_array);
        cp.no_stdin = 1;

        return run_command(&cp);

Ignore my previous comment. The cp.env API is *very* subtle. If the
line is just a name, it removes the environment variable, while
"name=value" adds it. That is definitely not what I was expecting
here, so I misread how it works.
I think that is modelled after how putenv(3) is made capable of
removing an existing environment variable.

Re: [PATCH v2] git: submodule honor -c credential.* from command line

From: Jacob Keller <hidden>
Date: 2016-06-15 23:08:28

On Thu, Feb 25, 2016 at 12:32 PM, Junio C Hamano [off-list ref] wrote:
Jacob Keller [off-list ref] writes:
quoted
On Wed, Feb 24, 2016 at 11:11 PM, Jeff King [off-list ref] wrote:
quoted
 static int clone_submodule(const char *path, const char *gitdir, const char *url,
                           const char *depth, const char *reference, int quiet)
 {
@@ -145,7 +166,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
        argv_array_push(&cp.args, path);

        cp.git_cmd = 1;
-       cp.env = local_repo_env;
+       add_submodule_repo_env(&cp.env_array);
        cp.no_stdin = 1;

        return run_command(&cp);

Ignore my previous comment. The cp.env API is *very* subtle. If the
line is just a name, it removes the environment variable, while
"name=value" adds it. That is definitely not what I was expecting
here, so I misread how it works.
I think that is modelled after how putenv(3) is made capable of
removing an existing environment variable.
Yes. It makes perfect sense once you read it, i was just very confused
at the initial glance because it felt like it was copying the entire
local_repo_env into the submodule child process. I just read the
technical API documentation and understand it now.

Thanks,
Jake
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help