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

Re: [PATCH v2] clone: Simplify string handling in guess_dir_name()

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Jul 9, 2015, 18:16 UTC
Message-ID
<CAHGBnuNLoNsxPK4YQ+HnT_q8F-HrVC_y9pZwB4G88jCq0-wCPg@mail.gmail.com>
In-Reply-To
<xmqq1tghw6jz.fsf@gitster.dls.corp.google.com>
On Thu, Jul 9, 2015 at 8:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Subject: Re: [PATCH v2] clone: Simplify string handling in guess_dir_name()
>
> We seem not to capitalize the first word on the subject line.
Will change that.
>> Content-Type: multipart/mixed;  boundary="----=_Part_8_836493213.1436462597065"
>
> Please don't.
This seems to come from submitgit, I've filed an issue about it:
https://github.com/rtyley/submitgit/issues/17
What content type(s) would you accept? Only text/plain?
Show 16 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
>> -             dir = xstrndup(start, end - start);
>> +     dir = is_bare ? xstrfmt("%.*s.git", (int)len, start) : xstrndup(start, len);
>
> This however I had to read twice.  I'd say
>
>         if (is_bare)
>                 dir = xstrfmt(...);
>         else
>                 dir = xstrndup(...);
>
> is much easier to read.
That's what I had locally before. Will revert to that.
-- 
Sebastian Schuberth
Previous: Junio C HamanoNext: Sebastian Schuberth
Message 6 of 24 in “clone: Make use of the strip_suffix() helper method”
  1. clone: Make use of the strip_suffix() helper methodSebastian Schuberth, Jul 9, 2015
  2. Jeff KingJul 9, 2015
  3. Sebastian SchuberthJul 9, 2015
  4. clone: Simplify string handling in guess_dir_name()Sebastian Schuberth, Jul 9, 2015
  5. Junio C HamanoJul 9, 2015
  6. Sebastian SchuberthJul 9, 2015
  7. clone: Simplify string handling in guess_dir_name()Sebastian Schuberth, Jul 9, 2015
  8. clone: simplify string handling in guess_dir_name()Sebastian Schuberth, Jul 9, 2015
  9. Junio C HamanoJul 9, 2015
  10. Sebastian SchuberthJul 9, 2015
  11. Lukas FleischerAug 4, 2015
  12. Sebastian SchuberthAug 4, 2015
  13. Jeff KingAug 4, 2015
  14. Patrick SteinhardtAug 5, 2015
  15. Jeff KingAug 5, 2015
  16. Patrick SteinhardtAug 5, 2015
  17. Jeff KingAug 5, 2015
  18. 0/2 fix clone guess_dir_name regression in v2.4.8Jeff King, Aug 5, 2015
  19. 1/2 clone: add tests for output directoryJeff King, Aug 5, 2015
  20. 2/2 clone: use computed length in guess_dir_nameJeff King, Aug 5, 2015
  21. Sebastian SchuberthAug 5, 2015
  22. Junio C HamanoAug 5, 2015
  23. Jeff KingAug 5, 2015
  24. Junio C HamanoJul 9, 2015

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.