Bug 245255 - [git-webkit] prepare-commit-msg does not work with --reedit-message and --reuse-message
Summary: [git-webkit] prepare-commit-msg does not work with --reedit-message and --reu...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 239082
  Show dependency treegraph
 
Reported: 2022-09-15 16:36 PDT by Elliott Williams
Modified: 2023-05-15 14:14 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Williams 2022-09-15 16:36:17 PDT
These git-commit options allow you to use the commit message from a different commit, and optionally stop for editing. They allow you to "rewrite" a commit by resetting to `main`, staging new changes, then running `git commit --reedit-message "HEAD@{1}"` to make changes to the old commit message.

Our prepare-commit-msg hook completely overwrites the commit message staged by these options, making them unusable. It should preserve the original message, and only list modified files in the comment section below the message body.
Comment 1 Radar WebKit Bug Importer 2022-09-22 16:37:17 PDT
<rdar://problem/100300158>
Comment 2 Sam Sneddon [:gsnedders] 2023-05-15 14:14:18 PDT
This looks like it was fixed by Bug 255121, except when I just tried to do this I got:

gsnedders@gsnedders-marsha webkitpy % git commit -c b318aede1356
  Running status to find changed, added, or removed files.
  Reviewing diff to determine which lines changed.
  Extracting affected function names from source files.
  Change author: Sam Sneddon <gsnedders@apple.com>.
  Running status to find changed, added, or removed files.
  Reviewing diff to determine which lines changed.
  Extracting affected function names from source files.
  Change author: Abrar Rahman Protyasha <a_protyasha@apple.com>.

And it displayed the author and commit message of `main` rather than of `b318aede1356`.