git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2016, 16:06 UTC
Message-ID
<xmqqk2fihv90.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<814aefbcf0f9380098e3f7a183399e11e24180dd.1471270061.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> 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
Previous: Johannes SchindelinNext: Junio C Hamano
Message 2 of 17 in “t/Makefile: make sure that file names are truly platform-independent”
  1. t/Makefile: make sure that file names are truly platform-independentJohannes Schindelin, Aug 15, 2016
  2. Junio C HamanoAug 15, 2016
  3. Junio C HamanoAug 15, 2016
  4. Jeff KingAug 15, 2016
  5. Johannes SchindelinAug 16, 2016
  6. Jeff KingAug 16, 2016
  7. Johannes SchindelinAug 16, 2016
  8. Jeff KingAug 16, 2016
  9. Junio C HamanoAug 15, 2016
  10. Johannes SchindelinAug 16, 2016
  11. Johannes SchindelinAug 16, 2016
  12. Junio C HamanoAug 16, 2016
  13. Junio C HamanoAug 16, 2016
  14. Johannes SchindelinAug 16, 2016
  15. Johannes SixtAug 16, 2016
  16. t/Makefile: make sure that paths can be checked out on platforms we careJohannes Schindelin, Aug 16, 2016
  17. t/Makefile: ensure that paths are valid on platforms we careJohannes Schindelin, Aug 16, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.