Subject: Re: [PATCH] t/Makefile: make sure that file names are truly platform-independent

From: Junio C Hamano <[email-masked]>
Date: Mon, 15 Aug 2016 09:06:35 -0700

Johannes Schindelin <[email-masked]> writes:

> Some file names that are okay on ext4 and on HFS+ are illegal in
> Windows. In order to stay truly platform-independent, Git's source code
> must not contain such illegal file names, even if things just happen to
> work on Linux.

Good thinking.

Some tests may have to be skipped on platforms that cannot express
certain paths, but even then they shouldn't ship a file with
pathname that cannot even be checked out (they should instead create
and use such a path, protected behind filesystem specific test
prerequisite).

> +test-lint-filenames:
> +	@illegal="$$(git ls-files | grep '["*:<>?\\|]')"; \

This pattern must exclude questionables on either NTFS or HFS+; it
is ironic that it is not even sufficient to limit ourselves to the
Portable Character Set [*1*], but such is life.

By the way, doesn't ls-files take pathspec glob, saving one extra
process to run grep?

    master$ git ls-files '*["*:<>?\\|]*'
    pu$ git ls-files '*["*:<>?\\|]*'
    t/t4013/diff.diff_--diff-line-prefix=-->_master_master^_side

Thanks.

> +		test -z "$$illegal" || { \
> +		echo >&2 "illegal file name(s): " $$illegal; exit 1; }

[Reference]

*1* http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html#tag_06_01