>Should I modify the test repo whether create a file on-the-fly?

Both options works for me.

>Per file encoding can be specified in .gitattributes file.

I didn't know about this option. Thanks for letting me know about it. However, I'm a bit confused, is that encoding attribute also leveraged by git.git when rendering the result of a diff?

/cc @arrbee