Re: [PATCH v4] clone: simplify string handling in guess_dir_name()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 9, 2015, 21:21 UTC
- Message-ID
- <xmqqfv4xuiwh.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <0000014e740f7a8a-2c988a36-633e-4b30-8024-cb4a1de1a8a2-000000@eu-west-1.amazonses.com>
Sebastian Schuberth <sschuberth@gmail.com> writes:
Show 9 quoted lines
> - if (is_bare) {
> - struct strbuf result = STRBUF_INIT;
> - strbuf_addf(&result, "%.*s.git", (int)(end - start), start);
> - dir = strbuf_detach(&result, NULL);
> - } else
> + if (is_bare)
> + dir = xstrfmt("%.*s.git", (int)len, start);
> + else
> dir = xstrndup(start, end - start);The last one needs to be adjusted with s/end - start/len/. The last-minute rewrite without testing shows; your first two patches correctly used "len" ;-)
No need to resend. Will locally tweak before queuing.
Thanks.