Search code examples
gitgit-lfsgit-ls-files

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


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?


Solution

  • 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.