git lfs ls-files-我的过滤器不适用于非ASCII文件夹名称

时间:2019-09-12 14:45:42

标签: git git-lfs git-ls-files

git lfs ls-files -I过滤器似乎不适用于非ASCII文件夹名称,即使该过滤器以八进制编码传递,也可以通过以下bash脚本确认:

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

虽然在我们的特殊情况下,不应该遇到带有非ASCII字符的文件夹,但这仍然是一个小小的麻烦事,并且是一个可能有效的用例。

那么,我是在做错什么,还是git lfs ls-files -I不支持非ASCII字符的过滤器?

1 个答案:

答案 0 :(得分:1)

当前,使用非ASCII字符用-I指定文件名已损坏。有一个open pull request可以解决,它将包含在Git LFS 2.9.0中。