Put part of working tree on another file-system.
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.
Signature · 1 line
Sergei.
Quoted 10 lines · Sergei Organov
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?
I needed to do this in Cygwin, and saw the same behaviour. I worked around it by using cygwin's "mount" command to "mount" the other directory in Cygwin's namespace. With this done, cygwin does not detect a symlink (since there is none), and works as expected.
With sufficient permissions, you can probably achieve the same effect with bind mounts perhaps (assuming Linux, of course).
Rogan
Quoted 12 lines · Rogan Dawes
Quoted 10 lines · Sergei Organov
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?
Quoted 7 lines
I needed to do this in Cygwin, and saw the same behaviour. I worked around it by using cygwin's "mount" command to "mount" the other directory in Cygwin's namespace. With this done, cygwin does not detect a symlink (since there is none), and works as expected.
With sufficient permissions, you can probably achieve the same effect with bind mounts perhaps (assuming Linux, of course).
Thanks for the idea, -- it seems to work.
[In fact it is Linux, and those "another file-system" is FAT32 partition, so that, when rebooting to Windoze, this directory could be accessed from there. I can't put all the working tree there as there are parts of the tree that depend on file system being case-sensitive.]
Signature · 1 line
Sergei.