Re: [PATCH v5 3/4] submodule: port set_name_rev() from shell to C
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 25, 2017, 03:55 UTC
- Message-ID
- <xmqq8th3fn4u.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <xmqqfubbfnan.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 11 quoted lines
> Nicely done.
>
>> + if (!capture_command(&cp, &sb, 0) && sb.len) {
> ...
> So, while it is not wrong per-se, I do not think we need to check
> revname[0] here. The helper never returns a non-NULL pointer that
> points at an empty string, right?
>
> On the other hand, if we dropped the "&& sb.len" check in the helper
> function to be more faithful to the original, then we must check
> revname[0] for an empty string.Ah, ignore all of the above. This will all be discarded in the next step [4/4], as far as I can tell. Perhaps we should drop this step and get directly to it, making the result a three-patch series instead, then, no?