From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: knu@idaemons.org, Eric Sunshine <sunshine@sunshineco.com>,
Git List <git@vger.kernel.org>
Subject: Re: [PATCH] sequencer.c: terminate the last line of author-script properly
Date: Thu, 26 Jul 2018 14:07:07 +0200 (DST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.1807261347040.71@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <xmqqpnzlla1p.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Tue, 17 Jul 2018, Junio C Hamano wrote:
> diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
> index 2d189da2f1..b0cef509ab 100755
> --- a/t/t3404-rebase-interactive.sh
> +++ b/t/t3404-rebase-interactive.sh
> @@ -81,11 +81,13 @@ test_expect_success 'rebase -i writes out .git/rebase-merge/author-script in "ed
You missed a very long line here.
> set_fake_editor &&
> FAKE_LINES="edit 1" git rebase -i HEAD^ &&
> test -f .git/rebase-merge/author-script &&
Why do we need this, if we already have an `eval` later on?
> - unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE &&
> - eval "$(cat .git/rebase-merge/author-script)" &&
> - test "$(git show --quiet --pretty=format:%an)" = "$GIT_AUTHOR_NAME" &&
> - test "$(git show --quiet --pretty=format:%ae)" = "$GIT_AUTHOR_EMAIL" &&
> - test "$(git show --quiet --date=raw --pretty=format:@%ad)" = "$GIT_AUTHOR_DATE"
> + (
> + sane_unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE &&
> + eval "$(cat .git/rebase-merge/author-script)" &&
Why not
. .git/rebase-merge/author-script
instead? Less roundabout, easier to read, I think.
> + test "$(git show --quiet --pretty=format:%an)" = "$GIT_AUTHOR_NAME" &&
How is this even working without `-s`?
*clicketyclick*
Ah, --quiet does this. Wait. `git show --quiet` is not even documented.
All of those lines are too long, though. I am surprised you did not catch
that.
Besides, this would be more compact, less repetitive, *and* more readable
as
test "$(git show -s --date=raw --format=%an,%ae,@%ad)" = \
"$GIT_AUTHOR_NAME,$GIT_AUTHOR_EMAIL,$GIT_AUTHOR_DATE"
t3404-rebase-interactive.sh already takes 8 minutes (last I checked,
anyway) to run on a *fast* machine. There is absolutely no need to
introduce even more spawning, not when it is so easily avoided.
> + test "$(git show --quiet --pretty=format:%ae)" = "$GIT_AUTHOR_EMAIL" &&
> + test "$(git show --quiet --date=raw --pretty=format:@%ad)" = "$GIT_AUTHOR_DATE"
It is a shame that we cannot use %at directly here.
> + )
> '
>
> test_expect_success 'rebase -i with the exec command' '
Note: this is not a criticism of the original patch. It is a criticism of
the review which could really have been better.
I also saw that the test_when_finished uses a shell construct that shell
script aficionados might like, but these days it is a lot better to use
`test_might_fail` instead. Let's do this, then.
So here goes, the clean-up patch on top of your 843654e435e (why does it
have to be so darned tedious to get from a mail to the corresponding
commit in `pu`), in all its glory:
-- snipsnap --
diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh
index b0cef509ab7..97f0b4bf881 100755
--- a/t/t3404-rebase-interactive.sh
+++ b/t/t3404-rebase-interactive.sh
@@ -75,18 +75,16 @@ test_expect_success 'rebase --keep-empty' '
test_line_count = 6 actual
'
-test_expect_success 'rebase -i writes out .git/rebase-merge/author-script in "edit" that sh(1) can parse' '
- test_when_finished "git rebase --abort ||:" &&
+test_expect_success 'rebase -i writes correct author-script' '
+ test_when_finished "test_might_fail git rebase --abort" &&
git checkout master &&
set_fake_editor &&
FAKE_LINES="edit 1" git rebase -i HEAD^ &&
- test -f .git/rebase-merge/author-script &&
(
sane_unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE &&
- eval "$(cat .git/rebase-merge/author-script)" &&
- test "$(git show --quiet --pretty=format:%an)" = "$GIT_AUTHOR_NAME" &&
- test "$(git show --quiet --pretty=format:%ae)" = "$GIT_AUTHOR_EMAIL" &&
- test "$(git show --quiet --date=raw --pretty=format:@%ad)" = "$GIT_AUTHOR_DATE"
+ . .git/rebase-merge/author-script &&
+ test "$(git show -s --date=raw --format=%an,%ae,@%ad)" = \
+ "$GIT_AUTHOR_NAME,$GIT_AUTHOR_EMAIL,$GIT_AUTHOR_DATE"
)
'
next prev parent reply other threads:[~2018-07-26 12:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-12 11:18 [PATCH] sequencer.c: terminate the last line of author-script properly Akinori MUSHA
2018-07-12 17:22 ` Junio C Hamano
2018-07-18 9:45 ` Phillip Wood
2018-07-18 13:46 ` [PATCH] sequencer.c: terminate the last line of author-scriptproperly Phillip Wood
2018-07-18 15:55 ` [RFC PATCH] sequencer: fix quoting in write_author_script Phillip Wood
2018-07-24 15:31 ` Junio C Hamano
2018-07-26 12:33 ` Johannes Schindelin
2018-07-27 10:36 ` Phillip Wood
2018-07-27 12:37 ` Johannes Schindelin
2018-07-30 9:35 ` Phillip Wood
2018-07-18 17:24 ` [PATCH] sequencer.c: terminate the last line of author-scriptproperly Junio C Hamano
2018-07-18 17:17 ` [PATCH] sequencer.c: terminate the last line of author-script properly Junio C Hamano
2018-07-19 9:20 ` Phillip Wood
2018-07-26 12:39 ` Johannes Schindelin
2018-07-26 17:53 ` Junio C Hamano
2018-07-12 20:13 ` Junio C Hamano
2018-07-12 20:16 ` Eric Sunshine
2018-07-12 20:23 ` Junio C Hamano
2018-07-17 23:25 ` Junio C Hamano
2018-07-18 6:23 ` Akinori MUSHA
2018-07-26 12:07 ` Johannes Schindelin [this message]
2018-07-26 17:44 ` Junio C Hamano
2018-07-27 15:49 ` Johannes Schindelin
2018-07-12 20:49 ` Junio C Hamano
2018-07-18 9:25 ` Phillip Wood
2018-07-18 13:50 ` Phillip Wood
2018-07-18 13:58 ` [PATCH] sequencer.c: terminate the last line of author-scriptproperly Phillip Wood
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=nycvar.QRO.7.76.6.1807261347040.71@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=knu@idaemons.org \
--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.
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).