How can I produce a list of filenames (incl. paths) that git knows about over the course of the whole history?
This lists all commits, then uses that to list all files in every commit. sort deduplicates. Only works for small-ish repos though as it takes a long time.
A better solution would be to use libgit2 to do the same, should be faster but requires some programming. A quick hack that implements this can be found on github. It uses pygit2 and is an order of magnitude faster than the shell pipeline above.