中文文件名:find 与 git ls-files / ls-tree 的区别

  • en 文件名 : OK

    git ls-files origin/dev | grep 'xx(副本)copy(副本).xxxxx' git ls-files 'xx(副本)copy(副本).xxxxx'
    "xx(\345\211\257\346\234\254)copy(\345\211\257\346\234\254).xxxxx"
    git ls-files origin/dev 'xx(副本)copy(副本).xxxxx' "xx(\345\211\257\346\234\254)copy(\345\211\257\346\234\254).xxxxx" git ls-tree origin/dev 'xx(副本)copy(副本).xxxxx'
    100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 "xx(\345\211\257\346\234\254)copy(\345\211\257\346\234\254).xxxxx"

git ls-tree / ls-tree 获得的中文文件名,是转义后的

$ git ls-tree origin/dev 'aa (副本) copy (副本) (副本).xxxxx'

100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 "aa (\345\211\257\346\234\254) copy (\345\211\257\346\234\254) (\345\211\257\346\234\254).xxxxx"

显示不正确:没有显示结果

  • 由于 git ls-tree / ls-tree 获得的文件名,是转义后的。所以 grep 在这里没有正确的结果显示。

$ git ls-tree origin/dev | grep 'aa (副本) copy (副本) (副本).xxxxx'

find 获得的中文文件名,是原样的

$ find . -name 'xx(副本)copy(副本).xxxxx' | grep 'xx(副 本)copy(副本).xxxxx'

./xx(副本)copy(副本).xxxxx

$ find . -name 'xx(副本)copy(副本).xxxxx'

./xx(副本)copy(副本).xxxxx

相关推荐
Apipi*4 小时前
30天速通Linux 第六章信号及信号处理
linux·运维·信号处理
天启HTTP5 小时前
爬虫防封核心原理:IP轮换机制与风控规避逻辑
linux·服务器·网络·爬虫·tcp/ip
广州浮点FLOATLIC7 小时前
许可证服务器迁移后软件打不开:研发 IT 怎样定位连接问题
linux·服务器·数据库
BLUcoding8 小时前
接口服务公网超时排查记录:SecureRandom 阻塞问题分析与解决
java·linux·springboot·aes·securerandom
AIgorithmGEEK8 小时前
[Linux]从手写报头到内核套路:序列化、反序列化与自定义协议全链路
linux·运维·服务器·网络·序列化·反序列化
Nil2088 小时前
leetcode 139单词拆分
linux·运维·服务器
Starry-sky(jing)8 小时前
BUG: unable to handle kernel paging request 完整排查:dmesg 四要素与三路定罪
linux·运维·服务器·内核·排障
mounter6258 小时前
从硬件互连到操作系统变革:CXL 技术演进与 Linux 内核工程挑战
linux·运维·服务器
xh didida9 小时前
Linux -- 基础IO
linux·服务器·开发语言·c++
zly350010 小时前
centos7 mount设备挂载 /dev/sda1/硬盘挂载
linux·运维·服务器