Re: [PATCH v4] submodule: port subcommand 'set-url' from shell to C
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 6, 2020, 18:22 UTC
- Message-ID
- <xmqqwo5o6hzp.fsf@gitster.c.googlers.com>
- In-Reply-To
- <20200506181239.GA5683@konoha>
Shourya Shukla <shouryashukla.oo@gmail.com> writes:
Show 9 quoted lines
>> By the way, looking at print_default_remote() that takes no
>> arguments wants argc to be 1, and resolve_relative_url() that takes
>> only one or two arguments checks for 2 or 3, shouldn't this be
>> checking if argc is 3, not 2?
>
> Aren't `path` and `newurl` the only arguments we should worry about
> here as 'parse_options' will parse out the other arguments ('git
> submodule--helper' and the 'quiet' option) leaving us with only the
> aforementioned arguments. Am I missing something here?Ah, I misread those examples that suggested that you are supposed to check for N+1 when you expect N arguments. They are *not* using parse_options() and that is where that funny numbering comes from.
This one uses "argc = parse_options(...)" so we should check for N when we want N args. Thanks.