2010-01-13 235 views
2

我设法让我的索引处于某些文件未按预期跟踪的状态。git未检测到某些文件中的更改

作为一个例子,我有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 

出于某种原因大小.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") 

删除索引并重置后,一切都恢复正常了:同时按预期test.h被修改

$ 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 msysgit 1.6.5.1在Windows上通过这个存储库上的samba出现奇怪之前。我无法从新的克隆中重现这一点。

我的直觉是,这是msysgit中的一个错误,也许与samba结合使用。有任何想法吗?

回答

3

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

这让我想知道这是计算机上的时钟问题。将服务器上的时间设置为-1h不会有帮助。
顺便说一句,gitx和git-gui可以通过同一台两台机器上的sshfs完美地工作(但即使方便,sshfs也不如本地网络上的samba快)。

Locking issue已知在克隆回购samba份额时发生。

2

我遇到了这个问题,版本1.7.9.msysgit.0

的问题是,我搬到这个项目到一个新的目录,我的子模块的ATLEAST一个曾经为worktree的绝对路径。

一旦我删除了子模块目录,在.git/modules中删除它们的条目,并重新初始化并更新它们,问题就消失了。

这很奇怪,因为git在检查项目状态时给出绝对没有错误或警告信息,只有当我做了一个git子模块更新时--init会显示出错误,不要走到它想要的路上。