ファイルシステムにシンボリックリンクを含むリポジトリを git clone するとvboxsf
、シンボリックリンクはすべて正常に機能しますが、変更がリポジトリに追加された場合でも、git は常にファイルが更新されたと表示します。
ext4
ルートのファイルシステムで使用すると、すべて正常に動作します。
Windows で Vagrant VM を使用しています。vboxsf ファイルシステムは、Windows ホストと共有されるディレクトリに使用されるタイプです。シンボリックリンクをサポートできます (基礎となるファイルシステムが Windows 上にあるにもかかわらず)。
$ git --version
git version 1.7.9.5
$ mount
--- snipped ---
vagrant-root on /vagrant type vboxsf (uid=1000,gid=1000,rw)
$ git init repo
Initialized empty Git repository in /vagrant/dev/repo/.git/
$ cd repo
$ echo foo > foo
$ ln -s foo bar
$ cat bar
foo
$ ls -l
total 1
lrwxrwxrwx 1 vagrant vagrant 0 Sep 12 17:34 bar -> foo
-rwxrwxrwx 1 vagrant vagrant 4 Sep 12 17:34 foo
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# bar
# foo
nothing added to commit but untracked files present (use "git add" to track)
$ git add --all
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: bar
# new file: foo
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: bar
#
$ git commit -m "1st commit"
[master (root-commit) ec99b71] 1st commit
2 files changed, 2 insertions(+)
create mode 120000 bar
create mode 100644 foo
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: bar
#
no changes added to commit (use "git add" and/or "git commit -a")
git v1.8.4 にアップグレードした後も同じ動作が得られます
そのため、git はクローン中にシンボリック リンクを適切に作成しているように見えますが、ファイルがコミットされているときにシンボリック リンクを正しく処理できません。
私の奇妙なfsがシンボリックリンクを行うことをgitに納得させるのに役立つgit設定はありますか?
更新vboxsf
Windowsホストを
使用して、仮想ボックス共有フォルダーファイルシステム( )で(私の目的のために)gitを動作させることができました。
- Virtual Box を管理者として実行 - これにより、ホスト ファイルシステムでシンボリック リンクを作成できるため、ゲスト ファイルシステムでシンボリック リンクを作成して使用できるようになります。
git update-index --assume-unchanged
各シンボリックリンクに使用します。git
これにより、シンボリックリンクが変更されたと考えることなく、他のファイルをコミットできます。
問題
- シンボリックリンクはWindowsでは機能しません(私はそうは思いませんが、そこで使用する必要はないので、あまり試していません)
- 新しいシンボリック リンクを作成したり、古いシンボリック リンクを編集したりするには、ext4 ボリュームで行う必要があります。