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

[PATCH v2] t/Makefile: make sure that paths can be checked out on platforms we care

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 16, 2016, 08:50 UTC
Message-ID
<5a23270d14386fa9fb8e75ab328337fef579d06f.1471337271.git.johannes.schindelin@gmx.de>
In-Reply-To
<814aefbcf0f9380098e3f7a183399e11e24180dd.1471270061.git.johannes.schindelin@gmx.de>

Some pathnames that are okay on ext4 and on HFS+ cannot be checked out on Windows. Tests that want to see operations on such paths on filesystems that support them must do so behind appropriate test prerequisites, and must not include them in the source tree (instead they should create them when they run). Otherwise, the source tree cannot even be checked out.

Make sure that double-quotes, asterisk, colon, greater/less-than, question-mark, backslash, tab, vertical-bar, as well as any non-ASCII characters above 0x7f never appear in the pathnames with a new test-lint-* target as part of a `make test`.

Noticed when a topic wanted to add a pathname with '>' in it. A check like this will prevent a similar problems from happening in the future.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	I re-munged the commit message (I saw that you munged it in `pu`
	and did not quite like the wording, so I permitted myself the
	indulgence).
	And of course I tested this, and it does *not* list all files in
	subdirectories of t/ as problematic.
Published-As: https://github.com/dscho/git/releases/tag/test-lint-filenames-v2
Fetch-It-Via: git fetch https://github.com/dscho/git test-lint-filenames-v2
Interdiff vs v1:
 diff --git a/t/Makefile b/t/Makefile
 index 3c0eb48..bf9cad9 100644
 --- a/t/Makefile
 +++ b/t/Makefile
 @@ -69,7 +69,7 @@ test-lint-shell-syntax:
  	@'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS)
  
  test-lint-filenames:
 -	@illegal="$$(git ls-files | grep '["*:<>?\\|]')"; \
 +	@illegal="$$(git ls-files | grep '[	"*:<>?\\|]')"; \
  		test -z "$$illegal" || { \
  		echo >&2 "illegal file name(s): " $$illegal; exit 1; }
  
 t/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/t/Makefile b/t/Makefile
index 18e2b28..bf9cad9 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -52,7 +52,8 @@ clean-except-prove-cache:
 clean: clean-except-prove-cache
 	$(RM) .prove
 
-test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax
+test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
+	test-lint-filenames
 
 test-lint-duplicates:
 	@dups=`echo $(T) | tr ' ' '\n' | sed 's/-.*//' | sort | uniq -d` && \
@@ -67,6 +68,11 @@ test-lint-executable:
 test-lint-shell-syntax:
 	@'$(PERL_PATH_SQ)' check-non-portable-shell.pl $(T) $(THELPERS)
 
+test-lint-filenames:
+	@illegal="$$(git ls-files | grep '[	"*:<>?\\|]')"; \
+		test -z "$$illegal" || { \
+		echo >&2 "illegal file name(s): " $$illegal; exit 1; }
+
 aggregate-results-and-cleanup: $(T)
 	$(MAKE) aggregate-results
 	$(MAKE) clean
-- 
2.9.2.691.g78954f3

base-commit: 70dce4aee55ad8a39a53f86f37a4bd400e0cac7d
Previous: Johannes SixtNext: Johannes Schindelin
Message 16 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.