git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Git Mailing List" <git@vger.kernel.org>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Alan Blotz" <work@blotz.org>,
	"Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH 3/4] difftool: use a strbuf to create the tmpdir path
Date: Sun, 19 Sep 2021 12:28:17 -0700	[thread overview]
Message-ID: <CAJDDKr7+GnXX=sPfUvyxZhWOXCe8P_aOYtY_XdGS6t=cRNm8wA@mail.gmail.com> (raw)
In-Reply-To: <d882e3a7-d459-5063-eca7-e77e1addfed5@kdbg.org>

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.

"""
-- 
David

  reply	other threads:[~2021-09-19 19:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19  1:57 [PATCH 1/4] t7800-difftool: cleanup temporary repositories used by tests David Aguilar
2021-09-19  1:57 ` [PATCH 2/4] difftool: add a missing space to the run_dir_diff() comments David Aguilar
2021-09-19  1:57 ` [PATCH 3/4] difftool: use a strbuf to create the tmpdir path David Aguilar
2021-09-19  2:17   ` Jeff King
2021-09-19  2:33     ` [PATCH v2 " David Aguilar
2021-09-20 18:35       ` Junio C Hamano
2021-09-19  9:00   ` [PATCH " Johannes Sixt
2021-09-19 18:13     ` David Aguilar
2021-09-19 18:46       ` Johannes Sixt
2021-09-19 19:28         ` David Aguilar [this message]
2021-09-19 19:50           ` Johannes Sixt
2021-09-19  1:57 ` [PATCH 4/4] difftool: fix symlink-file writing in dir-diff mode David Aguilar
2021-09-19  2:02   ` [PATCH v2 " David Aguilar
2021-09-19  2:21     ` [PATCH v3 " David Aguilar
2021-09-19 13:25 ` [PATCH 1/4] t7800-difftool: cleanup temporary repositories used by tests Ævar Arnfjörð Bjarmason
2021-09-20 18:28 ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJDDKr7+GnXX=sPfUvyxZhWOXCe8P_aOYtY_XdGS6t=cRNm8wA@mail.gmail.com' \
    --to=davvid@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=work@blotz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).