- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
由于文件名带有 ä,我的 git 情况很糟糕。这是一个可能存在多年的旧文件:
所以它用\303\244 标记为未跟踪,但如果我删除它,它反而标记为已删除,但用\314\210。非常混淆。我真的不关心文件,但想知道 future ......
~/d/p/uniply ❯❯❯ git status master ◼
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
"deployment/ec2/Prods\303\244ttning"
nothing added to commit but untracked files present (use "git add" to track)
~/d/p/uniply ❯❯❯ rm deployment/ec2/Prodsättning master ◼
~/d/p/uniply ❯❯❯ git status master ✖
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: "deployment/ec2/Prodsa\314\210ttning"
no changes added to commit (use "git add" and/or "git commit -a")
~/d/p/uniply ❯❯❯ git checkout -- deployment/ec2 master ✖
~/d/p/uniply ❯❯❯ git status master ◼
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
"deployment/ec2/Prods\303\244ttning"
nothing added to commit but untracked files present (use "git add" to track)
最佳答案
简短版本:您显然使用的是 Mac,它将所有文件名转换为 NFD,而 git 过去盲目地将文件名视为字节,但现在在 Mac 上将文件名转换为 NFC 以更好地与其他系统兼容。因此,提交中的旧路径会表现得很奇怪。
$ python3
>>> import unicodedata
>>> unicodedata.normalize('NFC', b'a\314\210'.decode()).encode()
b'\xc3\xa4'
>>> unicodedata.normalize('NFD', b'\303\244'.decode()).encode()
b'a\xcc\x88'
这些格式的全称是Normalization Form D(Canonical Decomposition)和Normalization Form C(Canonical Decomposition,followed by Canonical Composition),它们定义在UAX #15 .
在不区分大小写的文件系统上可能会发生类似的事情——尝试在 Windows 或 Mac 上检查 Linux 内核树! — 除了您可能希望找到一些同时包含 Makefile
和 makefile
的存储库之外,但是头脑正常的人不会 checkin 同时命名为 a\314\210
和 \303\244
,至少不是故意的。
核心问题是操作系统使相同的文件以不同的名称出现,因此如果它要查找的不是操作系统显示的默认名称,则 git 会根据其查找的内容看到不同的内容。
这是今天这条路径的行为方式,从头开始:
$ git init
Initialized empty Git repository
$ git config --get core.precomposeUnicode
true # this is the default in git 1.8.5 and higher
$ touch Prodsättning
$ env -u LANG /bin/ls -b
Prodsa\314\210ttning
$ git status -s
?? "Prods\303\244ttning"
通过在 C 语言环境中使用 ls
,我可以看到文件名中的字节,其中包含分解值。但是 git 是将字符组合成一个单一的代码点,这样不同平台的用户就不会产生不同的结果。 patch that introduced precomposed unicode explains in detail各种 git 命令会发生什么。
如果提交中的两个文件在 Unicode 规范化(或大小写折叠)之前具有相同的名称,那么当 git checkout 文件时它们将出现“打架”:
$ git clone https://gist.github.com/jleedev/228395a4378a75f9e630b989c346f153
$ git reset --hard && git status -s
HEAD is now at fe1abe4
M "Prods\303\244ttning"
$ git reset --hard && git status -s
HEAD is now at fe1abe4
M "Prodsa\314\210ttning"
因此,如果您只想删除该文件,您可以按照自己的意愿进行操作。如果您想可靠地操作这些文件,请查看设置 core.precomposeUnicode false 的选项,以便 git 将准确存储您告诉它的文件名字节,但这可能比它的值(value)更麻烦。我可能建议创建一个将所有文件名转换为 NFC 的提交,这样 git 就不会认为文件丢失了。
在 Git and the Umlaut problem on Mac OS X 上有一些关于这个问题的旧答案。 , 但其中许多早于 git 规范化 Unicode 的能力,并且设置 core.quotepath=false
只会在这种情况下引起混淆。
关于Git 与文件名中的 ä 混淆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41765181/
我真的很困惑。我已经尝试使用带有 tomcat 的 Jax-rs 并使用所有注释,我能够使用 url 调用我的服务。因此,如果没有 Jax-rs,我可以简单地拥有一个 servlet 并调用我的服务。
是否有任何工具/商业混淆器可以混淆 WPF 控件中的 BAML 资源? 如果没有,就 IP 保护而言,这是一段艰难的时期,因为黑客可以通过使用 BAML 到 XAML 转换器轻松查看 BAML 资源。
嘿大家。我在尝试使用 COBOL 在 zOS 环境中解决的编码项目中遇到了一些麻烦。我需要读入一个文件并将它们放入索引表中(我知道将少于 90 条记录)。 让我感到困扰的是,我们受到项目参数的约束,以
我试图按照这个例子来理解 join() 方法: class PrintDemo { public void printCount() { try { for(int
当我编译我正在编写的代码,然后在 JD Gui 中查看时,方法显示带有如下标题: public void growSurface(Random paramRandom, int paramInt1,
我正在为重新分发准备 Android 库,它的代码必须进行混淆处理。我已经阅读了有关此主题的一些内容,并且决定使用 Android Library Project。它将作为 jar 分发(自动在/bi
两个混淆相关的问题: 1) 是否有任何工具可以将 F# 从 MSIL 目标形式反汇编回其源形式或接近它的形式?这不是通过默默无闻来实现安全性的尝试,但我想保护某些源代码免遭“盗窃”。 2) 我简要地查
谁能向我解释为什么 simulatedCase <- rbinom(100,1,0.5) simDf <- data.frame(CASE = simulatedCase) posterior_m0
我一直无法找到关于使用 AppDomains 时发生的事情的非常清楚的描述,所以希望有人能够启发我。我有一个简单的测试程序(基本上是扯掉了 MSDN example ): using System;
假设我有 2 个分支topic和 master如果我在 topic分支,然后运行 git rebase master它是 rebase master 还是 rebase 主题分支? 做 git r
我有一个类(class): public class LockTest { public void LockThis() { lock (this)
我正在尝试最小化/混淆我的 Angular 代码,但遇到了问题。我在这里阅读“缩小说明”http://docs.angularjs.org/tutorial/step_05但我定义我的 Control
我遇到了一些困惑的操作。 var a = 0.1; var b = 0.2; var c = 0.3; console.log(a); // 0.1 console.log(b); // 0.2 co
感谢您查看我的帖子 - 我正在尝试弄清楚如何在单击链接时关闭此下拉菜单,但我的 JavaScript 技能非常缺乏,而且代码似乎很困惑。这是 HTML:
混淆、哈希和加密之间有什么区别? 这是我的理解: 哈希是一种单向算法;无法逆转 混淆与加密类似,但不需要任何“ secret ”即可理解(ROT13 就是一个例子) 加密是可逆的,但需要“ secre
我有以下代码 my $content = $response->content; $content =~ /username=([\s\S]+?)&/; my $username = $1; prin
我在 .NET 中发现了一些与我预期的有点不同的东西。我粘贴的代码没有意义,但它是我拥有的一个复杂得多的函数的浓缩版。我实际上是在获取匿名类型信息作为参数(尚未创建匿名类型的实例),我需要创建该类型的
我正在努力解决 JavaFX 应用程序的混淆问题。使用此项目作为基础: https://github.com/openjfx/samples/tree/master/IDE/IntelliJ/Non-
是否可以制作一个与此类似的 CSV 阅读器 while((line = reader.readLine()) != null){ String[] values = line.
公共(public)类测试2 { 公共(public)静态无效主(字符串[]参数){ System.out.println("3 + 6"); System.out.println(3
我是一名优秀的程序员,十分优秀!