How can a clean/smudge filter determine its data stream's file name?

561 Views Asked by At

In contrast to , clean and smudge are mere filters which are intended to directly process the file contents without being aware of any git functionality (since one may want to use native tools as cat or even gzip). But are there any environment variables or other means (other than scanning the repo for the file just getting fed with) to obtain the processed file's path?

1

There are 1 best solutions below

6
On BEST ANSWER

The clean and smudge filters are invoked once per file, with arguments. A %f in an argument is expanded to the file path, according to the documentation (scan down a bit inside the filter section).

Note that the smudge filter is not invoked (or re-invoked) in some cases you might expect. This includes git show (or so I am told; I have not tested this).