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

am-based rebase not applying filters

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Aug 1, 2019, 01:52 UTC
Message-ID
<20190801015204.GA12118@genre.crustytoothpaste.net>

Recently, someone[0] pointed out to me that am-based rebases don't apply smudge and clean filters on the final checkout.

Reproduction: ----- #!/bin/sh -e

mkdir test-repo cd test-repo git init git config filter.test.clean "sed -e 's/smudged/clean/g'" git config filter.test.smudge "sed -e 's/clean/smudged/g'"

echo a >a.bin git add a.bin git commit -m 'Add a.bin'

echo b >b.bin git add b.bin git commit -m 'Add b.bin'

git checkout -b test HEAD^

echo '*.txt filter=test' >.gitattributes git add .gitattributes git commit -m 'Add .gitattributes'

echo 'This text is smudged.' >a.txt git add a.txt git commit -m 'Add a.txt'

git rebase master grep 'smudged' a.txt -----

The correct behavior is to have the script print that the text is smudged, but with an am-based rebase, the text is clean. If you change the rebase to use -i or -m, the test succeeds (the filters are applied). This may also affect things like working-tree encodings or line endings; I'm not sure.

I'm planning on taking a look at fixing this (unless of course someone gets to it before me), but I wanted to mention this as in case it rang a bell for anyone.

I have no reason to think this is version-specific behavior, but I'm using Git 2.23.0.rc0.142.g4dedae46a2 from Debian experimental, and this also reproduces on a fairly recent master on macOS.

[0] This was brought to my attention by Erika Ellison.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Message 1 of 1 in “am-based rebase not applying filters”
  1. brian m. carlsonAug 1, 2019

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.