中文文件名: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

相关推荐
代码熬夜敲Q7 分钟前
网络工程相关
linux·服务器·网络
我先去打把游戏先21 分钟前
VMware NAT 模式 Ubuntu 虚拟机「宿主机能上网、虚拟机 ping 不通外网 + apt 更新卡死」全故障复盘
linux·运维·vscode·单片机·嵌入式硬件·ubuntu·keil5
开压路机24 分钟前
基础IO
linux·运维·服务器
JeJe同学1 小时前
LabelImg 标签字体大小修改教程
linux·人工智能·python
小鸡毛程序员1 小时前
从零搭建 Linux 开发服务器:VMware NAT 静态网络 + Docker + MySQL + Redis + 云服务器迁移
linux·服务器·网络
Cx330❀1 小时前
【Linux网络】一文吃透 TCP Socket 编程
linux·运维·服务器·开发语言·网络·tcp/ip
zizle_lin1 小时前
WSL初始化Ubuntu的使用
linux·运维·ubuntu·wsl
小刘的干货分享2 小时前
浙江必应推广百科:核心价值与本地合规服务商梳理
搜索引擎·微软
c++之路2 小时前
Linux 下 C++ 开发环境搭建
linux·运维·c++
溜达的大象2 小时前
Ubuntu服务器之间校时
linux·ubuntu·excel