Re: [filter-repo PATCH] filter-repo: add new --replace-message option
From: Gwyneth Morgan <hidden>
Date: 2021-08-23 20:54:12
On 2021-08-23 10:34:07-0700, Elijah Newren wrote:
Hi, On Tue, Aug 17, 2021 at 9:38 PM Gwyneth Morgan [off-list ref] wrote:quoted
Like --replace-text, add an option --replace-message which replaces text in commit message bodies, so that users can easily replace text without constructing a --message-callback.Interesting idea. Missing a Signed-off-by trailer.
Will fix.
quoted
@@ -894,7 +898,20 @@ YYYY-MM-DD. In the expressions file, there are a few things to note: beginning and ends of lines rather than the beginning and end of file. See https://docs.python.org/3/library/re.html for details. -See also the `--blob-callback` from <<CALLBACKS>>. +See also the `--blob-callback` from <<CALLBACKS>>. Similarly, if you +want to modify commit messages, you can do so with the same syntax. For +example, with a file named expressions.txt containing + +-------------------------------------------------- +foo==>bar +-------------------------------------------------- + +then running +-------------------------------------------------- +git filter-repo --replace-message expressions.txt +-------------------------------------------------- + +will replace `foo` in commit messages with `bar`.You've added this text to the "Content based filtering" section of the manual, which doesn't make sense. It should go in a section about updating commit/tag messages.
Ah, got it. I'll move that into a new section.
quoted
if self._message_callback: commit.message = self._message_callback(commit.message) -Why this stray line removal?
That was accidental. Will fix.
quoted
# Change the author & committer according to mailmap rules args = self._args if args.mailmap:As noted above, just as --message-callback affects both commit and tag messages, shouldn't this option affect both (i.e. should there also be a section in tweak_tag() similar to the one you added to tweak_commit())?
Yes, it should. I'll change that.