I answer my question. The error in my original solution is that the FILES set is incorrect, since diff is not executed between the overwritten parent and the current commit, but between the original parent and the current commit.
When passing through a set of such commits, the files that need to be changed are not a set of files affected by the commit, but also a set of files in which some parent latches ruined the end of the line.
This means that I am not getting the correct set of files. There is a map function provided to filter expressions that can convert the โoriginalโ revolution to a rewritten rev. When I use this function, it works correctly.
The resulting "single line" is as follows:
$ git filter-branch -f --tree-filter ' echo "\n $GIT_COMMIT"; P=$(git rev-parse $GIT_COMMIT^); echo $P; P=$(map $P); echo $P; git cat-file commit $GIT_COMMIT; FILES=$(git diff --name-only $GIT_COMMIT $P); echo "FILES:\n$FILES"; for a in $FILES; do git cat-file -e $P:$a > /dev/null 2>&1 || continue; if git show $P:$a | grep -qUP '\r'; then echo "parent is dos $a"; todos $a; else echo "parent is unix $a"; fromdos $a; fi; done; git add $FILES;' a6d9e..HEAD
Most aI doesn't think they need the last git add $ FILES ', but this is the command I used and I don't want to provide the wrong answer.
Note. You should also define FILES=$(git diff --name-only a6d9e HEAD) and, thus, use a fixed set to bypass commits. This is probably a lot easier, but I did not.
source share