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

Re: [PATCH 1/3] tree.c: update read_tree_recursive callback to pass strbuf as base

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 3, 2014, 16:13 UTC
Message-ID
<xmqq1toglnjf.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAPig+cS1OK6pv5A0vuJf=j6eFrNv70=AYgVz3zQny-md15_xKg@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 19 quoted lines
> On Tue, Dec 2, 2014 at 7:11 AM, Duy Nguyen <pclouds@gmail.com> wrote:
>> On Tue, Dec 2, 2014 at 2:32 AM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>>>
>>>> This allows the callback to use 'base' as a temporary buffer to
>>>> quickly assemble full path "without" extra allocation. The callback
>>>> has to restore it afterwards of course.
>>>
>>> Hmph, what's the quote around 'without' doing there?
>>
>> because it's only true if you haven't used up all preallocated space
>> in strbuf. If someone passes an empty strbuf, then underneath strbuf
>> may do a few realloc until the buffer is large enough.
>
> Would it be easier to understand if written like this?
>
>     This allows the callback to use 'base' as a temporary buffer to
>     quickly assemble full path, thus avoiding allocation/deallocation
>     for each iteration step.
Thanks.

I am not Duy so I do not know if that matches what he wanted to say, or if it matches what the change gives us. Your phrasing wouldn't have made me say "Hmph...?" and it is an improvement that goes in the right direction, I think.

A question during the review, especially on proposed log messages and documentation changes, is rarely just a request to explain it to the questioner in the discussion. It is an indication that what is being commented on needs tweaking to be understood.

Previous: Eric SunshineNext: Duy Nguyen
Message 6 of 11 in “ls-tree fixes”
  1. 0/3 ls-tree fixesNguyễn Thái Ngọc Duy, Nov 30, 2014
  2. 1/3 tree.c: update read_tree_recursive callback to pass strbuf as baseNguyễn Thái Ngọc Duy, Nov 30, 2014
  3. Junio C HamanoDec 1, 2014
  4. Duy NguyenDec 2, 2014
  5. Eric SunshineDec 3, 2014
  6. Junio C HamanoDec 3, 2014
  7. Duy NguyenDec 8, 2014
  8. 2/3 ls-tree: remove path filtering logic in show_treeNguyễn Thái Ngọc Duy, Nov 30, 2014
  9. 3/3 ls-tree: disable negative pathspec because it's not supportedNguyễn Thái Ngọc Duy, Nov 30, 2014
  10. Junio C HamanoDec 1, 2014
  11. Duy NguyenDec 2, 2014

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.