From: Bagas Sanjaya <bagasdotme@gmail.com>
To: git@vger.kernel.org
Subject: git revert --reference doesn't populate commit subject
Date: Tue, 18 Oct 2022 10:02:38 +0700 [thread overview]
Message-ID: <Y04XTl6yWXZv6xk5@debian.me> (raw)
[-- Attachment #1: Type: text/plain, Size: 1178 bytes --]
Hi,
When reverting commit with `git revert`, the subject for revert commit
is populated ("Revert <original commit subject>"). However, when
reverting with `git revert --reference`, the subject doesn't get
populated; only commit message is generated ("This reverts <original
commit reference>..."). When no subject is given, the first paragraph of
the message automatically becomes commit subject.
To reproduce:
```
$ mkdir /tmp/test && cd /tmp/test
$ git init && git branch -m main
$ echo "test" > test
$ git add test && git commit -m "test"
$ echo "whoops" > test
$ git commit -a -m "whoops"
$ git revert HEAD
// keep the commit message by just exiting the editor
$ git log -n 1 --pretty="format:%s" -p HEAD
Revert "whoops"
$ echo "whoops" > test
$ git commit -a -m "whoops again"
$ git revert --reference HEAD
// keep the commit message by just exiting the editor
$ git log -n 1 --pretty="format:%s" -p HEAD
This reverts <reference to "whoops again" commit>.
```
In the reproducer above, I expect that the second revert generates
`Revert "whoops again"` subject.
Thanks.
--
An old man doll... just what I always wanted! - Clara
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
reply other threads:[~2022-10-18 3:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=Y04XTl6yWXZv6xk5@debian.me \
--to=bagasdotme@gmail.com \
--cc=git@vger.kernel.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.
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).