git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH v3] revert: optionally refer to commit in the "reference" format
Date: Wed, 01 Jun 2022 14:52:46 -0700	[thread overview]
Message-ID: <xmqqmtewoxu9.fsf@gitster.g> (raw)
In-Reply-To: <220601.86zgiwz9uk.gmgdl@evledraar.gmail.com> ("Ævar Arnfjörð Bjarmason"'s message of "Wed, 01 Jun 2022 17:14:41 +0200")

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> I think a good solution to that would be to e.g. emit:
>
>     # *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***
>
>     Reverts commit <git reference>
>
>     This revert of a merge reverts changes made to <git reference 2>.
>
> Instead of what you have, which is:
>
>     # *** SAY WHY WE ARE REVERTING ON THE TITLE LINE ***
>
>     This reverts commit <git reference>, reversing
>     changes made to <git reference 2>.
>
> It's sharing a bit less code between the two, but I think the message is
> suffering for it now.

We shouldn't be making it inconvenient for our primary intended
audience.

The real first line is designed to be usable without editing for
them.  Those who forgets to write the title and ends up with "This
reverts ..." as the title can still identify such a commit for the
purpose of "rebase -i" and "commit --fixup", and that is good enough
for them.

But your version will force the intended audience to remove the
"Reverts ..." line, that strikes the balance at the wrong place.

>> +test_expect_success 'identification of reverted commit (revert.reference)' '
>> +	git checkout --detach to-ident &&
>> +	git -c revert.reference=true revert --no-edit HEAD &&
>> +	git cat-file commit HEAD >actual.raw &&
>> +	grep "^This reverts " actual.raw >actual &&
>> +	echo "This reverts commit $(git show -s --pretty=reference HEAD^)." >expect &&
>> +	test_cmp expect actual
>
> Also (probably mentioned) I'd find this much easier to read/review if it
> was using test_cmp, now you need to carefully parse the code to see what
> the outputs are like exactly, but if we compared the full output...

We are using test_cmp.  'actual' has what we care about (i.e. what
does the line that begin with "This reverts " say?) and compares it
with what we expect to see in 'expect'.

  reply	other threads:[~2022-06-01 21:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22  4:32 [PATCH] revert: optionally refer to commit in the "reference" format Junio C Hamano
2022-05-23 13:25 ` Johannes Schindelin
2022-05-23 22:48   ` Junio C Hamano
2022-05-27  6:01     ` [PATCH v3] " Junio C Hamano
2022-05-30 16:40       ` Johannes Schindelin
2022-05-31 14:00       ` Phillip Wood
2022-06-01  4:45         ` Junio C Hamano
2022-06-01 15:03           ` Phillip Wood
2022-06-01 15:14       ` Ævar Arnfjörð Bjarmason
2022-06-01 21:52         ` Junio C Hamano [this message]
2022-05-30 16:50     ` Side effects in Git's test suite, was Re: [PATCH] " Johannes Schindelin
2022-05-31  8:03       ` Ævar Arnfjörð Bjarmason
2022-05-23 13:45 ` Ævar Arnfjörð Bjarmason
2022-05-23 22:37   ` Junio C Hamano
2022-05-24  8:12     ` Ævar Arnfjörð Bjarmason
2022-05-24 19:11       ` Junio C Hamano
2022-05-26 11:17 ` Phillip Wood
2022-05-26 17:29   ` Junio C Hamano
2022-06-26  9:29 ` René Scharfe
2022-06-27 15:38   ` 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=xmqqmtewoxu9.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    /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).