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

Re: [PATCH 3/4] difftool: use a strbuf to create the tmpdir path

From
Johannes Sixt <j6t@kdbg.org>
Date
Sep 19, 2021, 19:50 UTC
Message-ID
<b348baca-d9a8-8e71-b40f-0aace9d15ae5@kdbg.org>
In-Reply-To
<CAJDDKr7+GnXX=sPfUvyxZhWOXCe8P_aOYtY_XdGS6t=cRNm8wA@mail.gmail.com>
Am 19.09.21 um 21:28 schrieb David Aguilar:
Show 60 quoted lines
> On Sun, Sep 19, 2021 at 11:46 AM Johannes Sixt <j6t@kdbg.org> wrote:
>>
>> Am 19.09.21 um 20:13 schrieb David Aguilar:
>>> A better title might be:
>>>
>>>     difftool: use a strbuf to generate a tmpdir path without double-slashes
>>>
>>> The double-slashes are the point. This patch is a minor cleanup that I
>>> found on the path towards fixing the data loss bug in patch 4.
>>>
>>> Thanks for the heads-up about the confusion ~ I'll reword in the next
>>> submission to make this point clearer.
>>
>> Thanks. My primary concern with the patch was actually that it looks
>> like mere code churn that introduces an error by not using is_dir_sep().
>> This is now settled.
>>
>> But still, without a justification why the slashes should be cleaned up,
>> the patch looks like code churn. You can ignore me if it is obvious for
>> others why we need the patch.
> 
> Nah, that's a good point. Thanks for clarifying. I'll hold off on
> resending until we've reached consensus on this patch.
> 
> The final bugfix patch is the most important one in the series so
> perhaps I should reorder the series so that the bugfix comes first,
> and these cosmetic improvements and typo fixes are the later ones in
> the series? That'll make it so that the bugfix is easier to backport
> and not entangled with these prep fixups.
> 
> I see double-slashes when using the dir-diff feature and they just
> look wrong to me, but "striving for perfection" is a mere subjective
> justification.
> 
> The double-slashes fixup is cosmetic from a technical perspective, but
> since the paths are exposed to the diff tools it's a cosmetic blemish
> that users will see front and center.
> 
> The test environment where I observed TMPDIR containing a trailing
> slash is macOS, so it's a fairly common setup. One justification is
> that we should not expose such blemishes to users -- that's what I've
> written below but perhaps there's a better way to express it?
> 
> What do you and others think about the proposed message below and
> whether or not this patch is worth applying?
> 
> """
> difftool: use a strbuf to create a tmpdir path without repeated slashes
> 
> The paths generated by difftool are passed to user-facing diff tools.
> Using paths with repeated slashes in them is a cosmetic blemish that
> is exposed to users and can be avoided.
> 
> Use a strbuf to create the buffer used for the dir-diff tmpdir.
> Strip trailing slashes "/" from the value read from TMPDIR to avoid
> repeated slashes in the generated paths.
> 
> Add a unit test to ensure that repeated slashes are not present.
> 
> """

With the justification that the path is user-visible you have my full consent to this patch. It shows a careful eye for the detail.

-- Hannes
Previous: David AguilarNext: David Aguilar
Message 11 of 16 in “t7800-difftool: cleanup temporary repositories used by tests”
  1. 1/4 t7800-difftool: cleanup temporary repositories used by testsDavid Aguilar, Sep 19, 2021
  2. 2/4 difftool: add a missing space to the run_dir_diff() commentsDavid Aguilar, Sep 19, 2021
  3. 3/4 difftool: use a strbuf to create the tmpdir pathDavid Aguilar, Sep 19, 2021
  4. Jeff KingSep 19, 2021
  5. 3/4 difftool: use a strbuf to create the tmpdir pathDavid Aguilar, Sep 19, 2021
  6. Junio C HamanoSep 20, 2021
  7. Johannes SixtSep 19, 2021
  8. David AguilarSep 19, 2021
  9. Johannes SixtSep 19, 2021
  10. David AguilarSep 19, 2021
  11. Johannes SixtSep 19, 2021
  12. 4/4 difftool: fix symlink-file writing in dir-diff modeDavid Aguilar, Sep 19, 2021
  13. 4/4 difftool: fix symlink-file writing in dir-diff modeDavid Aguilar, Sep 19, 2021
  14. 4/4 difftool: fix symlink-file writing in dir-diff modeDavid Aguilar, Sep 19, 2021
  15. Ævar Arnfjörð BjarmasonSep 19, 2021
  16. Junio C HamanoSep 20, 2021

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.