From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] push: support remote branches in guess_ref DWIM
Date: Tue, 27 Oct 2009 20:01:04 -0400 [thread overview]
Message-ID: <20091028000104.GA9426@sigill.intra.peff.net> (raw)
In-Reply-To: <7vaazc31sj.fsf@alter.siamese.dyndns.org>
On Tue, Oct 27, 2009 at 03:33:16PM -0700, Junio C Hamano wrote:
> > $ git fetch ;# presumably gets origin/branch
> > $ git push origin/branch:renamed-branch
> >
> > which is much nicer than exposing clueless users to
> > ":refs/heads/renamed-branch".
>
> You would need to expose ":refs/heads/branch" to make this a rename, not a
> copy, wouldn't you?
Yeah, you're right. This was based on an actual user request, and I
didn't think too closely about the other steps. But since the deletion
is of an existing branch, you should be able to do that without
refs/heads. So:
$ git push origin origin/branch:renamed-branch
$ git push origin :branch
Which of course you could do in one command if you wanted to live
(more) dangerously.
> > Am I missing some part of your argument?
>
> I do not see much point (other than your "rename" example) in pushing what
> you got from the other end without changing anything yourself back to the
> same remote.
I don't either; my hope was that we can make that case a little bit
easier without creating undue hardship for anybody else.
> There was a thread in which people argued that the primary thing that is
> dangerous in this sequence
>
> $ git checkout origin/next; work-commit; work-commit; ...
>
> is when you leave the detached HEAD state without saving it to a local
> branch. I think what is more dangerous is that it will not give the user
> a solid understanding that these commits do _not_ change origin/next in
> any way. After doing the above, it is understandable that a novice would
> mistakenly think: "I started from origin/next and built some, let's push
> the result".
I suppose it's possible. I don't have any evidence that users actually
think that way.
> With such a misconception, you will see the likely mistake here, too:
>
> $ git push origin origin/next:refs/heads/next
>
> If "rename" is the _only_ valid reason you might want to push what you got
> from there back to the same remote, _and_ if "rename" is something very
> often needed, I think we would prefer to have a way to support that
> operation directly, instead of more general DWIM that would risk passing
> mistakes like the above unwarned.
OK, I can buy that. It would be much nicer even to support explicit
renaming (in fact, the user request started with that, and I just didn't
want to give them an answer that involved refs/heads/, which I think is
unnecessarily scary to users).
> IOW, it's between "prevent push with dubious $src from happening in the
> first place" vs "give them rope". Historically I always sided with the
> latter camp, but I am trying to play a devil's advocate for a change ;-).
Heh. Thanks for explaining your thinking.
Let's scrap this for now, then. Remote rename doesn't actually come up
very often, and I agree that it would be nice to have an actual atomic
movement, which is what people really want.
-Peff
prev parent reply other threads:[~2009-10-28 0:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-26 21:33 [PATCH] push: support remote branches in guess_ref DWIM Jeff King
2009-10-26 23:31 ` Junio C Hamano
2009-10-27 1:45 ` Jeff King
2009-10-27 22:33 ` Junio C Hamano
2009-10-28 0:01 ` Jeff King [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091028000104.GA9426@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).