git lfs ls-files -I filter doesn't work with non-ASCII folder names

256 views Asked by At

git lfs ls-files -I filter seems not to work with non-ASCII folder names even when the filter is passed in octal encoding, as can be confirmed with the bash script below:

mkdir LfsTestRepo
cd LfsTestRepo
git init
git lfs -v # git-lfs/2.7.2 (GitHub; windows amd64; go 1.12.2; git 08a08ae0)
git lfs install
echo "*.dll filter=lfs diff=lfs merge=lfs -text" > .gitattributes
# ASCII
mkdir "A B"
echo "some binary data" > "A B/C.dll" 
# Non-ASCII
mkdir "А Б"
echo "some binary data" > "А Б/В.dll" 
git add --all
git commit -m "DLLs added"

git lfs ls-files # Shows both files
git lfs ls-files -I "/A B/*" # ASCII - shows the file with folder filter
git lfs ls-files -I "/А Б/*" # Non-ASCII - doesn't show the file with folder filter

git ls-files -s ":(attr:filter=lfs)А Б" # Non-ASCII native ls-files shows the file (octal encoding)

git lfs ls-files -I "/\320\220 \320\221/*" # Non-ASCII - doesn't show the file even with octal encoding

While in our particular case folders with non-ASCII characters shouldn't probably be ever encountered, it is still a minor nuisance and a potentially valid use-case.

So, am I doing something wrong, or is it just that git lfs ls-files -I doesn't support filters with non-ASCII characters?

1

There are 1 answers

2
bk2204 On BEST ANSWER

Currently, specifying a file name with -I using non-ASCII characters is broken. There's an open pull request to fix it which will be included in Git LFS 2.9.0.