美文网首页
FileMode 被改动引发的XCode编译错误

FileMode 被改动引发的XCode编译错误

作者: VinZZZZ | 来源:发表于2019-10-24 17:27 被阅读0次

表现:

编译的KSCrash.framework上传到git上后, 之前一直使用正常。后来某天出现编译不过,提示找不到里面的头文件:

07BADB4E-ECDF-4A27-8615-94790CFB68BD.jpg

对比之前的framework,

image.png

发现 Resources和 Headers两个文件夹类型的软链接, 被修改成了文本文件。原来是文件的mode由 120000 被Windows端的同学提交git时改成了 100644。

解决办法:

提醒Windows端同学修改git设置:

git config --global false

不做 filemode的改变。

参考

自:https://my.oschina.net/xhan/blog/493454 , 这里做下原文备份:

提交代码到仓库时,发现明明没有改动的文件提示有修改,并且是很多的文件都提示有修改。

但是修改的添加行和删除行都是 0。

于是 diff 一下。

$ git diff code.c

old mode 100755

new mode 100644

原来是文件模式发生了变化。

想了下,可能是别人从 Mac 上提交,我在 Win 上 pull 代码,导致文件模式发生了变化。

到网上看了一下如何修改:

git config core.filemode false

也可以直接修改代码仓库 .git 目录里的 config 文件的 filemode (在 [core] 段中)字段,将其改为 false。

如果要全局修改的话,加 --global 选项:

git config --global core.filemode false

fileMode 的解释:

core.fileMode

   If false, the executable bit differences between the index and the

   working copy are ignored; useful on broken filesystems like FAT.

   See git-update-index(1). True by default.

参考链接:

http://stackoverflow.com/questions/1580596/how-do-i-make-git-ignore-file-mode-chmod-changes

顺便查了下这个文件模式 100644 是什么意思。

我们经常见的是后三位,比如上面的 644,UNIX 里的文件模式记法。

在 shell 里 ls -l 时第一列就是。

那么前三位代表了什么呢?

经查,前三位代表了文件类型。100 是普通文件的意思。

其它的常见类型如下所示:

0100000000000000 (040000): Directory

1000000110100100 (100644): Regular non-executable file

1000000110110100 (100664): Regular non-executable group-writeable file

1000000111101101 (100755): Regular executable file

1010000000000000 (120000): Symbolic link

1110000000000000 (160000): Gitlink

更详细的情况请参考下面的链接:

How to read the mode field of git-ls-tree's output

http://stackoverflow.com/questions/737673/how-to-read-the-mode-field-of-git-ls-trees-output

相关文章

网友评论

      本文标题:FileMode 被改动引发的XCode编译错误

      本文链接:https://www.haomeiwen.com/subject/lfydvctx.html