git跟踪目录中的文件,但不跟踪目录本身 - git中的bug?

时间:2013-08-10 18:01:27

标签: git git-submodules

我对git的理解不包括这种情况。通过运行git reset --hard HEADgit clean -fd,我无法使'git status'变得干净。似乎git正在跟踪目录中的两个文件,而不是目录本身。这是一段摘录

~/work/ghc/libraries/haskeline ((no branch)) $ git status
# Not currently on any branch.
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   "tests/dummy-I\314\202\302\274I\314\202\302\261I\314\210\302\203/"
nothing added to commit but untracked files present (use "git add" to track)

~/work/ghc/libraries/haskeline ((no branch)) $ git clean -fd
Removing "tests/dummy-I\314\202\302\274I\314\202\302\261I\314\210\302\203/"

~/work/ghc/libraries/haskeline ((no branch)) $ git status
# Not currently on any branch.
# 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:    "tests/dummy-\303\216\302\274\303\216\302\261\303\217\302\203/bar"
#   deleted:    "tests/dummy-\303\216\302\274\303\216\302\261\303\217\302\203/\303\217\302\202\303\216\302\265\303\217\302\201\303\217\302\204"
#
no changes added to commit (use "git add" and/or "git commit -a")

~/work/ghc/libraries/haskeline ((no branch)) $ git reset --hard
HEAD is now at 40bcd6a Fix build on Win64

~/work/ghc/libraries/haskeline ((no branch)) $ git status
# Not currently on any branch.
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   "tests/dummy-I\314\202\302\274I\314\202\302\261I\314\210\302\203/"
nothing added to commit but untracked files present (use "git add" to track)

~/work/ghc/libraries/haskeline ((no branch)) $ git log tests/dummy-μαÏ/
~/work/ghc/libraries/haskeline ((no branch)) $ git log tests/dummy-\303\216\302\274\303\216\302\261\303\217\302\203/bar
fatal: ambiguous argument 'testests/dummy-303216302274303216302261303217302203/bar': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

~/work/ghc/libraries/haskeline ((no branch)) $ git log "testests/dummy-\303\216\302\274\303\216\302\261\303\217\302\203/bar"
fatal: ambiguous argument 'testests/dummy-\303\216\302\274\303\216\302\261\303\217\302\203/bar': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

~/work/ghc/libraries/haskeline ((no branch)) $ cd tests/dummy-μαÏ/
~/work/ghc/libraries/haskeline/tests/dummy-Î¼Î±Ï ((no branch)) $ ls
Ï?εÏ?Ï?         bar

~/work/ghc/libraries/haskeline/tests/dummy-Î¼Î±Ï ((no branch)) $ git status
# Not currently on any branch.
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   "../dummy-I\314\202\302\274I\314\202\302\261I\314\210\302\203/"
nothing added to commit but untracked files present (use "git add" to track)

~/work/ghc/libraries/haskeline/tests/dummy-Î¼Î±Ï ((no branch)) $ git log bar 
commit e9c39a16fdecf529e7a86beb3971eb351e915de5
Author: Judah Jacobson <judah.jacobson@gmail.com>
Date:   Sun Jul 22 22:14:08 2012 +0000

    Add test folder for unit-testing file completion.

~/work/ghc/libraries/haskeline/tests/dummy-Î¼Î±Ï ((no branch)) $ git log .
commit e9c39a16fdecf529e7a86beb3971eb351e915de5
Author: Judah Jacobson <judah.jacobson@gmail.com>
Date:   Sun Jul 22 22:14:08 2012 +0000

    Add test folder for unit-testing file completion.

~/work/ghc/libraries/haskeline/tests/dummy-Î¼Î±Ï ((no branch)) $ cd ..
~/work/ghc/libraries/haskeline/tests ((no branch)) $ git log dummy-μαÏ/
~/work/ghc/libraries/haskeline/tests ((no branch)) $ 

这是我应该报告的git中的错误(可能与涉及的非ascii文件名有关)吗?如果没有,有人可以解释为什么这是有道理的吗?

最后一点:libraries / haskeline目录是ghc目录中的git子模块。我不知道这会产生什么影响。 此外,我的提示包含当前的git分支。明确地运行命令

~/work/ghc/libraries/haskeline/tests ((no branch)) $ git branch
* (no branch)
  master

0 个答案:

没有答案