How would I protect a certain file from being processed by a git filter?

149 views Asked by At

Say I've got that git filter that does some cleanup on the XML files used in my project. Configuration is done like this:

*.xml filter=clear-xml

One thing that filter does in the clean step is to check whether there's an empty line at the end of the file and if not, it adds one. The smudge part of the filter does nothing.

Now, there's this single unique XML file that gets generated without an empty line at the end. This file shall not be processed by the clear-xml filter.

How would I approach this problem?

1

There are 1 answers

2
VonC On BEST ANSWER

As illustrated in "Apply multiple filters for same files in git", you cannot chain multiple filters: the last one apply.

That means you could declare a second "noop" filter (one which does nothing) specifically for your file.

*.xml filter=clear-xml
yourFile.xml filter=noop