Put part of working tree on another file-system.
- From
- Sergei Organov <osv@javad.com>
- Date
- Dec 5, 2007, 13:44 UTC
- Message-ID
- <87mysp8ddk.fsf@osv.gnss.ru>
Hello,
I've a desire to put a sub-tree of my working tree into another file-system. With CVS I've used symlink to achieve this. It works fine with CVS as it doesn't care about directories and symlinks at all. I had little hope it will work with GIT, but I've performed a test anyway. To my surprise it almost worked, so I have a hope that maybe it's not that difficult to support this. What do you think? Or maybe there is a different way to achieve the goal with GIT?
The test has been performed in a clone of the git tree (my comments are prefixed by "osv>"):
$ git status # On branch master nothing to commit (working directory clean) $ mv gitweb ../ && ln -s ../gitweb . $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # gitweb nothing added to commit but untracked files present (use "git add" to track)
osv> here GIT is slightly confused by the change of a directory to a osv> symlink to a directory.
$ echo hehe >> gitweb/INSTALL $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # # modified: gitweb/INSTALL # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # gitweb no changes added to commit (use "git add" and/or "git commit -a")
osv> here confusion is more obvious as GIT reports modified file in an osv> untracked directory.
$ git commit -a
Created commit 7470207: The commit 1 files changed, 1 insertions(+), 0 deletions(-) $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # gitweb nothing added to commit but untracked files present (use "git add" to track)
osv> surprisingly nothing very bad happened, -- GIT has commited the osv> modified file just fine, and left the symlink unchanged. $ git reset --hard HEAD^ HEAD is now at 7a4a2e1... Set OLD_ICONV on Cygwin. [osv@fulcrum git]$ git status # On branch master # Changed but not updated: # (use "git add/rm <file>..." to update what will be committed) # # deleted: gitweb/README # deleted: gitweb/git-favicon.png # deleted: gitweb/git-logo.png # deleted: gitweb/gitweb.css # deleted: gitweb/gitweb.perl # deleted: gitweb/test/Märchen # deleted: gitweb/test/file with spaces # deleted: gitweb/test/file+plus+sign # no changes added to commit (use "git add" and/or "git commit -a")
osv> Ooops, -- now things begin to be more seriously broken. The result osv> is that GIT removed the symlink, created gitweb directory, and put osv> only INSTALL file into it. The directory the symlink was pointing osv> to has the rest of files but INSTALL.
$ git reset --hard HEAD HEAD is now at 7a4a2e1... Set OLD_ICONV on Cygwin. $ git status # On branch master nothing to commit (working directory clean)
osv> This is now as expected, -- GIT just re-populated the gitweb osv> directory as there is no symlink anymore.
-- Sergei.