gpt4 book ai didi

git 没有检测到某些文件的更改

转载 作者:太空狗 更新时间:2023-10-29 14:40:57 32 4
gpt4 key购买 nike

我已设法让我的索引处于某些文件未按预期跟踪的状态。

例如,我在工作目录中有未修改的 size.h 和 test.h:

$ git-ls-files -st size.h test.h
H 100644 de2c741b07d86f92bdd660626848072cb2bf510f 0 size.h
H 100644 8bb24bc7483ffcfc0fc1a3761dc63e86a1b3e003 0 test.h
$ git status
# On branch master
nothing to commit (working directory clean)

然后我对这两个文件做了一些随机更改:

$ fortune >> size.h
$ fortune >> test.h

出于某种原因,size.h 没有被修改(尽管文件显然被修改了)。同时按预期修改test.h:

$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: test.h
#
no changes added to commit (use "git add" and/or "git commit -a")

删除索引并重置后一切恢复正常:

$ rm .git/index
$ git reset
Unstaged changes after reset:
M size.h
M test.h
$ git status
# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: size.h
# modified: test.h
#
no changes added to commit (use "git add" and/or "git commit -a")

在奇怪出现之前,我一直在 CentOS 上使用 git 1.6.6,在 Windows 上通过 samba 在 Windows 上使用 msysgit 1.6.5.1。我无法从新的克隆中重现这一点。

我的直觉是这是 msysgit 中的错误,可能与 samba 结合使用。有什么想法吗?

最佳答案

我看到的唯一一个也会显示 Git over samba 错误状态的错误是 GitX ticket 147 .
它是关于相反的情况(git status 显示未修改的文件的修改),但表明文件的某些元素(大小?日期?权限?)未通过 samba 共享正确传输。

This made me wonder wether this was a clock problem on the computer. Setting the time on the server to -1h does not help.
BTW, gitx and git-gui work perfectly through sshfs on the same two machines (but, even though convenient, sshfs is not as fast as samba on a local network).

Locking issue已知在通过 samba 共享克隆 repo 时会发生这种情况。

关于git 没有检测到某些文件的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2060294/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com