Re: [PATCH v2 0/8] git-submodule.sh: improve parsing of options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> wrote:

> Just to make sure we are on the same page,
>
>     --foo "hello world"
>
> is an example of an option "foo" that takes exactly one argument, a
> string which happens to have a whitespace in it, and is an example
> for which "variable has the dash-dash option, equals, and its value"
> pattern would not work well.

I'm not sure why then this pattern would not work; when the argument is
passed to the option in this case, we set the variable to "--foo=$2",
so it should be fine (like you've written below).

> If we can pass it as
>
>     --foo="hello world"
>
> then we are safe, as we can do
>
>         foo="--foo=hello world"
>         ... later ...
>         git cmd ${foo:+"$foo"}

All of the options with arguments of git-submodule--helper can be
passed as "--foo=...", and spaces (or other misc characters) that
appear in the option value shouldn't pose any problem whatsoever;
the logic in parse-options.c::parse_long_opt confirms that.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux