Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)
- From
- Chris Wedgwood <cw@f00f.org>
- Date
- Jul 13, 2005, 20:44 UTC
- Message-ID
- <20050713204458.GB11403@taniwha.stupidest.org>
- In-Reply-To
- <Pine.LNX.4.58.0507131256490.17536@g5.osdl.org>
On Wed, Jul 13, 2005 at 01:05:02PM -0700, Linus Torvalds wrote:
> This is really complicated, for no good reason.
What should I be doing?
> The _object_ directories should be linked, but it's really wrong to link > the "refs/" directories and expect them to have COW behaviour.
I'm confused.
This function in only used to update various files, one of which is .git/HEAD
The complexity I added was to deal with a situation where we have
tree1/ .git/HEAD -> refs/head/master
and I do "cp -Rl tree1 tree2" giving me:
tree2/ .git/HEAD -> refs/head/master
and .git/refs/head/master is hardlinked between both trees.
Cogito will do "echo <foo> > .git/HEAD" which update *both* tree1 and tree2 which is not what I want. So the idea is to readlink and do the update using echo + rename to get the CoW semantics I desire.
Yes, weird things happen if you have out-of-treel links but I suspect if you do that with cogito you've probably lost anyhow.
> I've tried to make most of the git tools write the refs objects > "safely" too, ie things like "git-receive-pack" (the receiving end > of a "git-send-pack") will write the new ref to a lock-file and then > do a "rename()" to set it.
Yes, git is probably fine. Cogito isn't.
> That is COW-safe, but the thing is, it's incredibly painful for many > other operations, and I won't guarantee that git in general is > always going to be COW-safe wrt all the git files.
What operations is this painful for?