git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git revert --reference doesn't populate commit subject
@ 2022-10-18  3:02 Bagas Sanjaya
  0 siblings, 0 replies; only message in thread
From: Bagas Sanjaya @ 2022-10-18  3:02 UTC (permalink / raw)
  To: git

[-- 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 --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-18  3:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-18  3:02 git revert --reference doesn't populate commit subject Bagas Sanjaya

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).