Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Chris Wedgwood
On Wed, Jul 13, 2005 at 02:23:18PM -0700, Linus Torvalds wrote: > If you really want to do something like this, then you should do it like > this: > > update_head() { except there are a number of places I need to frob things in Cogito and they are not all for the head. If the head is speci

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Chris Wedgwood
On Wed, Jul 13, 2005 at 02:33:43PM -0700, Linus Torvalds wrote: > Hmm.. I don't think it's necessarily wrong, although as you say, > your editor had better DTRT. It does. I assume probably everything does but I never really checked. > That said, even if your editor doesn't, at least you won't c

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Linus Torvalds
On Wed, 13 Jul 2005, Chris Wedgwood wrote: > > I would however like to be able to hardlink more than just the > _object_ directory --- hardlinking the source is quite nice too. > Might that be considered safe? (I'm of course assuming that editors > do write + rename when saving their buffers).

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Linus Torvalds
On Wed, 13 Jul 2005, Chris Wedgwood wrote: > > How about the following? > > echo_to_file() { > local DEST="$2" > local count=1 > local RET > > # follow symlinks until we run out or end up with something > # dangling > while [ -L "$DEST" ] ; do If you re

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Chris Wedgwood
On Wed, Jul 13, 2005 at 02:05:35PM -0700, Linus Torvalds wrote: > > and .git/refs/head/master is hardlinked between both trees. > > AND THAT IS WRONG. OK, I was more-or-less assuming that 'cp -Rl tree1 tree2' was always a valid thing to do. Clearly if it's not then all of this is somewhat moot

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Linus Torvalds
On Wed, 13 Jul 2005, Chris Wedgwood wrote: > > 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

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Chris Wedgwood
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. T

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Chris Wedgwood
On Wed, Jul 13, 2005 at 10:07:24PM +0200, Matthias Urlichs wrote: > You lose if the link is relative and the symlink is not in the > current directory. Cogito doesn't create such links in my (limited_ experience. Why would anyone else do that? > You also lose on systems where the empty filename

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Matthias Urlichs
Hi, Chris Wedgwood: > How about the following? > Ummm... > local NLINK=`readlink "$DEST"` > > if [ ! -e "$NLINK" ] ; then You lose if the link is relative and the symlink is not in the current directory. You also lose on systems where the empty filename is synonymous with t

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Linus Torvalds
On Wed, 13 Jul 2005, Chris Wedgwood wrote: > On Wed, Jul 13, 2005 at 09:03:26AM +0200, Matthias Urlichs wrote: > > > You are ;-) the tree itsels is no symlinked, but HEAD points to > > refs/heads/ by default. > > Thanks for pointing that out. I honestly never noticed that. > > How about the

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Chris Wedgwood
On Wed, Jul 13, 2005 at 09:03:26AM +0200, Matthias Urlichs wrote: > You are ;-) the tree itsels is no symlinked, but HEAD points to > refs/heads/ by default. Thanks for pointing that out. I honestly never noticed that. How about the following? echo_to_file() { local DEST="$2"

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-13 Thread Matthias Urlichs
Hi, Chris Wedgwood wrote: > Symlink'd trees don't really make sense to me (they seem fragile and > somewhat pointless) but perhaps I'm missing something? You are ;-) the tree itsels is no symlinked, but HEAD points to refs/heads/ by default. Don't clobber that, please. -- Matthias Urlichs |

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-12 Thread Chris Wedgwood
On Tue, Jul 12, 2005 at 09:37:00PM +, Junio C Hamano wrote: > > if [ "$newhead" ]; then > > echo "Committed as $newhead." > > - echo $newhead >$_git/HEAD > > + echo_to_file $newhead $_git/HEAD > > [ "$merging" ] && rm $_git/merging $_git/merging-sym $_git/merge-base > > Good inten

Re: [RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-12 Thread Junio C Hamano
Chris Wedgwood f00f.org> writes: > if [ "$newhead" ]; then > echo "Committed as $newhead." > - echo $newhead >$_git/HEAD > + echo_to_file $newhead $_git/HEAD > [ "$merging" ] && rm $_git/merging $_git/merging-sym $_git/merge-base Good intentions, but wouldn't the above clobb

[RFC PATCH] cogito --- don't overwrite metadata files in place (breaks CoW use)

2005-07-12 Thread Chris Wedgwood
Sometimes (often actually) I do: cp -Rl tree1 tree2# new tree with implied CoW semantics cd tree2 cg-update # or similar the latter well frob .git/HEAD or similar by doing echo foo > bar which obviously breaks the intended CoW semantics. How would pe