git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jacob Keller <jacob.keller@gmail.com>
Date
Feb 25, 2016, 06:19 UTC
Message-ID
<CA+P7+xpkbZyuQ7gpC+_KzJPfGo+xHpVFWEmr1oS7FD30jjJSOQ@mail.gmail.com>
In-Reply-To
<CAPig+cROoc+Y-V_6hw6Hx4X9pFGmRjfhpzYGKhswwa=bA5b=+g@mail.gmail.com>
On Wed, Feb 24, 2016 at 4:27 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 14 quoted lines
>> ---
>> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
>> @@ -255,6 +255,61 @@ static int module_clone(int argc, const char **argv, const char *prefix)
>> +/* Rules to sanitize configuration variables that are Ok to be passed into
>> + * submodule operations from the parent project using "-c". Should only
>> + * include keys which are both (a) safe and (b) necessary for proper
>> + * operation. Right now only "credential.*" fits both criteria.
>> + */
>
> Drop the final sentence for a couple reasons:
>
> 1. It's merely repeating what the code itself already says, and...
> 2. It's likely to become outdated when additional variables are added.
>
Yep. I'll drop that, makes sense.
Show 7 quoted lines
> Also, style:
>
>     /*
>      * Multi-line comment
>      * style.
>      */
>

Hah. I contribute to the netdev kernel a lot, and for some reason they prefer the style above (but only in net/ code). I get into a habbit of doing that too much I'll fix this.

Show 6 quoted lines
>> +               /* combined all the values before we quote them */
>
> Comment repeats what the code already says, thus not terribly useful.
>
> Also: s/combined/combine/
>

I tend to make comments like this when I change the obvious way it was done, I commented this because I based it on a scratch patch from Jeff that didn't have them put together before quoting.

Show 10 quoted lines
>> +               strbuf_addstr(&quoted, var);
>> +               strbuf_addch(&quoted, '=');
>> +               strbuf_addstr(&quoted, value);
>
> strbuf_addf(&quoted, "%s=%s", var, value);
>
>> +               /* safely quote them for shell use */
>
> Comment repeats what the code already says.
>
Will drop this as well.
Show 5 quoted lines
>
> Perhaps not a big deal since the program exits immediately after, but you could:
>
>     strbuf_release(&sanitized_config);
>
Yep, just an oversight, same for the quoted string as well.
Show 5 quoted lines
>> +       local sanitized_config = $(git submodule--helper sanitize-config)
>
> Is 'local' a bashism? (Although, I see that 'local' is already being
> used in relative_path(); perhaps that ought to be cleaned up.)
>

Apparently it is, I wasn't aware of that. It's supported on more than bash, but it's not POSIX.

Show 7 quoted lines
>> +
>> +test_description='Basic plumbing support of submodule--helper
>> +
>> +This test tries to verify the submodule--helper plumbing command used
>
> Maybe: s/tries to verify/verifies/
>

Yes. I used "tries" with the intention of needing tests for the actual functionality as submodule--helper is expected to go away.

Thanks for the review, I'll have these cleaned up in v3

Regards, Jake

Previous: Jeff KingNext: Jeff King
Message 4 of 14 in “git: submodule honor -c credential.* from command line”
  1. git: submodule honor -c credential.* from command lineJacob Keller, Feb 24, 2016
  2. Eric SunshineFeb 25, 2016
  3. Jeff KingFeb 25, 2016
  4. Jacob KellerFeb 25, 2016
  5. Jeff KingFeb 25, 2016
  6. Jacob KellerFeb 25, 2016
  7. Jeff KingFeb 25, 2016
  8. Jacob KellerFeb 25, 2016
  9. Jeff KingFeb 25, 2016
  10. Jeff KingFeb 25, 2016
  11. Jacob KellerFeb 25, 2016
  12. Jacob KellerFeb 25, 2016
  13. Junio C HamanoFeb 25, 2016
  14. Jacob KellerFeb 25, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.