git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [filter-repo PATCH] filter-repo: add new --replace-message option

From
Gwyneth Morgan <gwymor@tilde.club>
Date
Aug 23, 2021, 20:53 UTC
Message-ID
<YSQK0JeaXtKWPgU2@tilde.club>
In-Reply-To
<CABPp-BF3EopyXGtKomnVjuavg2dX+79qLwkPjjyX+PO5JBSXtg@mail.gmail.com>
On 2021-08-23 10:34:07-0700, Elijah Newren wrote:
Show 11 quoted lines
> Hi,
> 
> On Tue, Aug 17, 2021 at 9:38 PM Gwyneth Morgan <gwymor@tilde.club> wrote:
> >
> > 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.
Show 23 quoted lines
> > @@ -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.
Show 5 quoted lines
> >      if self._message_callback:
> >        commit.message = self._message_callback(commit.message)
> > -
> 
> Why this stray line removal?
That was accidental. Will fix.
Show 8 quoted lines
> >      # 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.
Previous: Elijah NewrenNext: Gwyneth Morgan
Message 3 of 5 in “filter-repo: add new --replace-message option”
  1. filter-repo: add new --replace-message optionGwyneth Morgan, Aug 18, 2021
  2. Elijah NewrenAug 23, 2021
  3. Gwyneth MorganAug 23, 2021
  4. filter-repo: add new --replace-message optionGwyneth Morgan, Aug 23, 2021
  5. Elijah NewrenAug 25, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.