edit: spellchecker corrected reflinks, this is what I meant.
edit: spellchecker corrected reflinks, this is what I meant.
``` cd $(mktemp -d) git init test ( cd test; touch README.md; git add README.md; git commit -m "Test"; ) git clone test/.git test_clone find test_clone/.git/objects test/.git/objects -type f -printf "%i\t%p\n" | sort ```
You'll see the same inodes used in both clones.
CoW and reflinks let you share everything, including the non-immutable paths, and even stuff like node_modules.
// Didn't double-check, but I've held this belief for over decade now, would be surprised to be proven wrong
CoW is similar except the new inode is created by the file system itself and is independent of the editor.
echo old > a
ln a b
echo new > a
cat a b # prints "new" and "new"
Some programs like GNU sed [1] do create new inodes, but that is a property of the application, not the filesystem: echo old > a
ln a b
sed -i 'c new' a
cat a b # prints "new" and "old"
With reflinks in a CoW filesystem the inodes are different from the start, but share the same underlying blocks: echo old > a
cp --reflink=always a b
ls -i a b # prints different inodes
echo new > a
cat a b # prints "new" and "old"
[1] https://www.gnu.org/software/sed/manual/html_node/Command_00...Thanks for examples and especially the doc link. I don't normally use hard links, and for some reason was sure that's how they behave.
Maybe my belief indeed stemmed from observing software which overwrites opened file with a new copy.