From: Taylor Blau <me@ttaylorr.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Samuel Adekunle Abraham via GitGitGadget <gitgitgadget@gmail.com>,
git@vger.kernel.org,
"brian m. carlson" <sandals@crustytoothpaste.net>,
Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Patrick Steinhardt <ps@pks.im>,
Phillip Wood <phillip.wood@dunelm.org.uk>,
Junio C Hamano <gitster@pobox.com>,
Samuel Adekunle Abraham <abrahamadekunle50@gmail.com>
Subject: Re: [PATCH v3] notes: teach the -e option to edit messages in editor
Date: Mon, 21 Oct 2024 15:52:26 -0400 [thread overview]
Message-ID: <Zxaw+pUMT4juAePD@nand.local> (raw)
In-Reply-To: <CAPig+cSw_F97nBzO3Z7t2Zrv5TZwGnYiQLhpq2iKgLfxhhxvfQ@mail.gmail.com>
On Mon, Oct 21, 2024 at 02:28:05PM -0400, Eric Sunshine wrote:
> On Mon, Oct 21, 2024 at 12:53 PM Taylor Blau <me@ttaylorr.com> wrote:
> > On Mon, Oct 21, 2024 at 02:38:15PM +0000, Samuel Adekunle Abraham via GitGitGadget wrote:
> > > + MSG="Edited notes message" git notes add -m "Initial notes message" -e &&
> > > + echo "Edited notes message" >expect &&
> >
> > Very nice use of the fake_editor script here.
> >
> > It is a little cumbersome to repeat the same message in MSG= and when
> > populating the 'expect' file. Perhaps instead this could be written as:
> >
> > echo "edited notes message" >expect &&
> > MSG="$(cat expect)" git notes -add -m "initial" -e
>
> This suggested rewrite feels unusually roundabout and increases
> cognitive load for readers who now have to trace the message flow from
> script to file and back into script, and to consider how the loss of
> trailing newline caused by use of $(...) impacts the behavior. It also
> wastes a subprocess (which can be expensive on some platforms, such as
> Windows). If we're really concerned about this minor duplication of
> the message, we can instead do this:
>
> msg="edited notes message" &&
> echo "$msg" >expect &&
> MSG="$msg" git notes -add -m "initial" -e
I am not sure I agree that the suggested version is clearer. The way I
read mine is that we are writing what we expect to see in "expect", and
then setting up MSG to be the same thing.
I definitely do not feel strongly between the two and would rather avoid
nitpicking something as trivial as this when compared to the rest of the
patch, especially considering that I would be equally happy with your
version.
I think the whole thing is a little bit of a moot point, though, because
by far the thing that is least clear here is that setting MSG has the
side-effect of modifying the behavior of the fake-editor that we set up
earlier in the script. So I don't know that optimizing for clarity in
how we setup and write to the "expect" file is the right thing to spend
our time on.
Thanks,
Taylor
next prev parent reply other threads:[~2024-10-21 19:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-19 0:14 [PATCH] notes: teach the -e option to edit messages in editor Samuel Adekunle Abraham via GitGitGadget
2024-10-19 0:38 ` brian m. carlson
2024-10-19 11:03 ` Kristoffer Haugsbakk
2024-10-19 11:24 ` Samuel Abraham
2024-10-19 10:28 ` Kristoffer Haugsbakk
2024-10-19 11:19 ` Samuel Abraham
2024-10-19 11:36 ` Kristoffer Haugsbakk
2024-10-19 11:58 ` Samuel Abraham
2024-10-20 0:03 ` [PATCH v2] " Samuel Adekunle Abraham via GitGitGadget
2024-10-21 11:58 ` Patrick Steinhardt
2024-10-21 12:37 ` Samuel Abraham
2024-10-21 18:22 ` Eric Sunshine
2024-10-21 14:38 ` [PATCH v3] " Samuel Adekunle Abraham via GitGitGadget
2024-10-21 16:52 ` Taylor Blau
2024-10-21 17:12 ` Samuel Abraham
2024-10-21 18:28 ` Eric Sunshine
2024-10-21 19:52 ` Taylor Blau [this message]
2024-10-21 18:12 ` [PATCH v4] " Samuel Adekunle Abraham via GitGitGadget
2024-10-21 19:53 ` Taylor Blau
2024-10-21 21:44 ` Samuel Abraham
2024-10-23 6:14 ` Patrick Steinhardt
2024-10-23 16:51 ` Samuel Abraham
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zxaw+pUMT4juAePD@nand.local \
--to=me@ttaylorr.com \
--cc=abrahamadekunle50@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
--cc=sunshine@sunshineco.com \
/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.
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 NNTP newsgroup(s).