git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Phillip Wood <phillip.wood@dunelm.org.uk>,
	Elijah Newren <newren@gmail.com>,
	Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Victor Gambier <vgambier@excilys.com>
Subject: Re: [PATCH 1/3] t3403: fix commit authorship
Date: Mon, 16 Aug 2021 09:36:43 -0700	[thread overview]
Message-ID: <xmqq8s11s5wk.fsf@gitster.g> (raw)
In-Reply-To: <043edd52-c666-0939-bf6d-51b0d225157e@gmail.com> (Phillip Wood's message of "Sun, 15 Aug 2021 21:04:36 +0100")

Phillip Wood <phillip.wood123@gmail.com> writes:

> I wonder if it would be better to hard code the author in this test rather
> than rather than relying on git log like this

To be quite honest, I am pretty happy with the tests as posted, and
the choice among various ways we are discussing depends on what the
likely mode of breakage we expect.

The breakage we are expecting to catch in the second hunk of your
patch is somehow "rebase -i" fails to keep the authorship of
amended-goodbye and ends up making the commit at HEAD under
different authorship.

 - A likely source of a different authorship information that would
   be recorded, when such a bug gets introduced, is from the
   environment (i.e. GIT_AUTHOR_NAME etc. that test-lib.sh sets up).
   This can happen by a new bug in the test added before the second
   hunk of your patch we see below, and with or without this patch,
   such a bug in the test will not be caught.

 - Or amended-goodbye may by a test bug have been recorded under a
   wrong authorship information to begin with, and if it were done
   as the default author we use in our tests (i.e. the bug you fixed
   in your patch that started this thread).  If we reintroduced such
   a bug, the second hunk of this patch will help.

 - Or the variable $another_author gets clobbered in a future change
   between the two hunks of this patch, and the check in the second
   hunk would be broken.

Overall, I do not think any of the above breakage is so likely to
happen, and that is why I am happy with the tests as posted.  The
necessity for a plain shell variable to retain its value for such a
long haul across tests the patch below introduces may be making the
test more brittle than safer.

So...

> diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh
> index e26762d0b2..c90e32817f 100755
> --- a/t/t3403-rebase-skip.sh
> +++ b/t/t3403-rebase-skip.sh
> @@ -34,9 +34,10 @@ test_expect_success setup '
>         git tag reverted-goodbye &&
>         git checkout goodbye &&
>         test_tick &&
> -       GIT_AUTHOR_NAME="Another Author" \
> -               GIT_AUTHOR_EMAIL="another.author@example.com" \
> -               git commit --amend --no-edit -m amended-goodbye &&
> +       another_author="Another Author <another.author@example.com>" &&
> +       git commit --amend --no-edit -m amended-goodbye \
> +               --author="$another_author" --date="$GIT_AUTHOR_DATE" &&
> +       another_author="$another_author $GIT_AUTHOR_DATE" &&
>         test_tick &&
>         git tag amended-goodbye &&
>  @@ -110,8 +111,10 @@ test_expect_success 'correct authorship when
> committing empty pick' '
>         test_must_fail git rebase -i --onto goodbye \
>                 amended-goodbye^ amended-goodbye &&
>         git commit --allow-empty &&
> -       git log --pretty=format:"%an <%ae>%n%ad%B" -1 amended-goodbye >expect &&
> -       git log --pretty=format:"%an <%ae>%n%ad%B" -1 HEAD >actual &&
> +       git log --pretty=format:"$another_author%n%B" -1 amended-goodbye \
> +                >expect &&
> +       git log --date=raw --pretty=format:"%an <%ae> %ad%n%B" -1 HEAD \
> +               >actual &&
>         test_cmp expect actual
>  '
>  

  reply	other threads:[~2021-08-16 16:36 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10  9:31 [PATCH 0/3] rebase --continue: remove .git/MERGE_MSG Phillip Wood via GitGitGadget
2021-08-10  9:31 ` [PATCH 1/3] t3403: fix commit authorship Phillip Wood via GitGitGadget
2021-08-10 17:01   ` Elijah Newren
2021-08-10 18:43     ` Junio C Hamano
2021-08-12 10:04       ` Phillip Wood
2021-08-14 21:53         ` Johannes Schindelin
2021-08-15 17:36           ` Junio C Hamano
2021-08-15 20:04             ` Phillip Wood
2021-08-16 16:36               ` Junio C Hamano [this message]
2021-08-17 10:05                 ` Phillip Wood
2021-08-10  9:31 ` [PATCH 2/3] rebase --apply: restore some tests Phillip Wood via GitGitGadget
2021-08-10 16:58   ` Elijah Newren
2021-08-12 10:03     ` Phillip Wood
2021-08-10  9:31 ` [PATCH 3/3] rebase --continue: remove .git/MERGE_MSG Phillip Wood via GitGitGadget
2021-08-10 17:03 ` [PATCH 0/3] " Elijah Newren
2021-08-12 13:42 ` [PATCH v2 " Phillip Wood via GitGitGadget
2021-08-12 13:42   ` [PATCH v2 1/3] t3403: fix commit authorship Phillip Wood via GitGitGadget
2021-08-12 13:42   ` [PATCH v2 2/3] rebase --apply: restore some tests Phillip Wood via GitGitGadget
2021-08-12 13:42   ` [PATCH v2 3/3] rebase --continue: remove .git/MERGE_MSG Phillip Wood via GitGitGadget
2021-08-13 23:01     ` Junio C Hamano
2021-08-14 20:01       ` Phillip Wood
2021-08-13  0:46   ` [PATCH v2 0/3] " Elijah Newren
2021-08-13 15:31     ` Junio C Hamano
2021-08-13 17:21       ` Elijah Newren
2021-08-14 20:02         ` 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

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

  git send-email \
    --in-reply-to=xmqq8s11s5wk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=newren@gmail.com \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=vgambier@excilys.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).