Noam Cohen reports that git ls-tree is documented to print filenames verbatim with -z. Since 455923e0a1, which introduced --format, the %(path) placeholder has always been C-quoted. The patch outputs it verbatim when -z is given, as git ls-files --format already does.

The second version builds a path containing a double quote using git mktree, which keeps the test within US-ASCII and independent of the filesystem. It also forces core.quotePath=true.

Junio C Hamano said forcing core.quotePath was what he had in mind, but that avoiding non-ASCII bytes is not a requirement. He said tests that use such bytes are much better than none, and the point is only to avoid platform anomalies. He called the code change trivially correct.

Noam replied that the only ASCII bytes quote_c_style() quotes are control characters, DEL, double quote and backslash. Windows does not allow most of these in filenames, and DEL felt too obscure. He noted that a test_commit-based setup is simpler than mktree and that other tests already use non-ASCII paths. He asked whether to drop the test or add a similar one for ls-files --format. Junio observed that the ls-files --format commit documents -z but added no test for --format="%(path)" with -z.

A third version has since been posted.