Re: Problem with a push

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 12 Jun 2007, Andy Parkins wrote:
> 
> I agree its odd, but is it really true that one (I) shouldn't be doing it?

No, it's definitely not a hard rule, and it's perfectly fine to push any 
refs at all, including remotes.

It's just that we probably shouldn't do it by *default*.

There's another slight detail to this story, which is what caused Alex to 
notice in the first place: we tried to push to something that was a 
symref, which actually caused *another* ref to update. Again, there's 
nothing wrong about that theoretically (it's what symrefs are there for!), 
but again, it's probably something we shouldn't do by default.

So there's a big difference between:

 - git _can_ do it, and it's perfectly sane to do when you know what you 
   are doing and have a very specific issue.

and

 - git not only _can_ do it, but will do it even when you didn't 
   explicitly tell it to do that..

> Can I tell you what I'm doing, and check that it's not crazy...
> 
> I have my laptop and my desktop computer; I use both for development.  
> I've set them so that they are symmetric...
> 
> laptop:.git/config
>  [remote "desktop"]
>    url = ssh://blah blah blah
>    fetch = refs/heads/*:refs/remotes/desktop/*
>    push = refs/heads/*:refs/remotes/laptop/*
> 
> desktop:.git/config
>  [remote "laptop"]
>    url = ssh://blah blah blah
>    fetch = refs/heads/*:refs/remotes/laptop/*
>    push = refs/heads/*:refs/remotes/desktop/*
> 
> This is very handy, as git-push on one does the same as git-fetch on the 
> other.  Have I made a glaring mistake by pushing to a remote ref?

I think this is perfectly sane, exactly because you did it explicitly, and 
partly exactly *because* you explicitly don't do what git push does by 
default (which is to update the "remote" refs remotely with what are the 
remote refs locally!).

IOW, the notion of "remote" refs really logically implies a mirror image, 
exactly like you have it set up in your config: what is a local ref in one 
repository is a remote ref in another. But that's not what the default 
"git push" semantics are: it just matches refs directly, without that 
mirroring.

And the _reason_ for it doing that are obviously historical: we didn't use 
to have the notion of "remotes", so back when I did that, it made sense. 
It just doesn't make sense any more.

Junio: I suspect this is really an area worth changing semantics in, the 
same way we changed the semantics for the defaults for "git pull". And I 
suspect it will confuse a lot fewer people, because fewer people depend on 
the default behaviour of "git push".

		Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux