Skip to content

Commit

Permalink
t/103-unicode: workaround unicode normalization on newer macOS.
Browse files Browse the repository at this point in the history
As named, the file would be extracted by git on macOS, then
(un)helpfully normalized by the macOS filesystem. After that,
"git clean -fdx" would delete the file, since it no longer
had the expected name, so git thought it wasn't part of its repo.

I considered pre-normalizing the filename, but a) that would break
on any future OS that normalizes differently; and b) that means we
won't test denormalized filenames. Instead, we'll remove the directory
from git, and create it from sh instead, then figure out what name
it got really created as, and then pass the "real" name to redo.
  • Loading branch information
apenwarr committed Jul 24, 2019
1 parent bc9cc75 commit 262d272
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions t/103-unicode/clean.do
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm -rf *.tmp
Empty file.
16 changes: 15 additions & 1 deletion t/103-unicode/unicode.do
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# Test that redo can handle a script whose path contains non-ASCII characters.
redo test-uniçøðë/test1
# Note: the test directory is intentionally *not* a normalized unicode
# string, ie. filesystems like macOS will convert it to a different string
# at creation time. This tests weird normalization edge cases.
#
# Unfortunately, on macOS with APFS, it may helpfully normalize the path at
# *create* time, but not on future *open* attempts. Thus, we let the shell
# figure out what directory name actually got created, then pass that to redo.
# Hence the weird wildcard expansion loop.
rm -rf test-uni*.tmp
mkdir "test-uniçøðë.tmp"
for p in test-uni*.tmp; do
: >$p/test1.do
redo "$p/test1"
done

0 comments on commit 262d272

Please sign in to comment.