git attributes filter, determine file type from shebang

87 Views Asked by At

I am using git attributes and filters for auto-formatting before diff and add.

I have a filter for *.[ch], and another for *.py.

I have a number of python scripts that lack a suffix in their filename. These always have a shebang as their first line.

Is it possible to trigger a clean filter based on the content of a file? I'd typically try to parse for something like ^#!.*python.*.

0

There are 0 best solutions below