git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Holger Hellmuth <hellmuth@ira.uka.de>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
	Neal Kreitzinger <nkreitzinger@gmail.com>,
	git@vger.kernel.org
Subject: Re: who's on first? - following first parent and merge-management
Date: Fri, 09 Mar 2012 14:25:14 +0100	[thread overview]
Message-ID: <4F5A04BA.8030401@ira.uka.de> (raw)
In-Reply-To: <4F59F7A2.3030606@viscovery.net>

On 09.03.2012 13:29, Johannes Sixt wrote:
> Am 3/9/2012 13:05, schrieb Holger Hellmuth:
>> On 08.03.2012 18:30, Junio C Hamano wrote:
>>> Johannes Sixt<j.sixt@viscovery.net>   writes:
>>>> To avoid the situation,...
>>>> This would not be necessary if the order of the merge parents could be
>>>> specified, e.g.:
>>>>
>>>>      # on topic
>>>>      git merge --into master
>>>
>>> I think the underlying mechanism needed to implement the above
>>> shares a lot with what Jeff called "crazy idea", but where you would
>>> want to be after such a merge may be different in these two cases.
>>
>> I don't think there is much question that you should still be in the same
>> branch. Not because you necessarily want to be in that branch. But because
>> it would be surprising if git-merge changed your branch sometimes and most
>> times not.
>
> I don't think that it is so clear-cut. And for this reason, I would even
> go as far as to suggest that you should end up with a detached HEAD.
>
> Before the merge we have this situation:
>
> --o--o--o--o<- master
>     \
>      o--o--o--X<- topic
>
> The result of 'git merge --into master' must advance branch master by the
> merge commit (I think there is no doubt about this):
>
> --o--o--o--o---M<- master
>     \          /
>      o--o--o--X<- topic
>
> Also, the index and worktree must match M (no doubt, either, IMO). But
> what does HEAD refer to? I see three possibilities:

I see we have different ideas. I envisioned --into to be the equivalent of
git checkout master
git merge topic
git checkout topic

and in that case index and worktree would be topic naturally.

But your caveat below would be even more problematic in this case.

> 1. master; as you say, this may be surprising if we were on topic before
> the branch.
>
> 2. topic; but then the index would be dirty because it does not match X.
>
> 3. M, i.e. a detached HEAD; this is just a compromise and a fat warning at
> the end of the merge output would be necessary that instructs the user to
> checkout a suitable branch.
>
> Now that I have tossed around these ideas, there's another caveat: What if
> the merge fails due to a conflict? After the conflicts were resolved, 'git
> commit' is needed to complete the merge. But this would create the commit
> where HEAD points to. IOW, we have to chose option 1 so that the merge
> commit advances master.
>
> Would this be less surprising if the option were named --checkout-into?

Don't think so. It would make it clear where you end up but it would 
muddle/hide the original purpose of the parameter. "git merge --into 
xxx" sounds like a real sentence (Larry Wall would approve ;-).

Guess we would have to rely on the documentation to make it clear that a 
branch switch happens. And a message "Changing to branch xxx" on STDOUT 
wouldn't hurt either.

  reply	other threads:[~2012-03-09 13:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07  5:36 who's on first? - following first parent and merge-management Neal Kreitzinger
2012-03-07  7:37 ` Junio C Hamano
2012-03-08  6:13   ` Junio C Hamano
2012-03-08  7:14     ` Jeff King
2012-03-08  7:38       ` Junio C Hamano
2012-03-08  8:03       ` Johannes Sixt
2012-03-08 17:30         ` Junio C Hamano
2012-03-09 12:05           ` Holger Hellmuth
2012-03-09 12:29             ` Johannes Sixt
2012-03-09 13:25               ` Holger Hellmuth [this message]
2012-03-09 16:26                 ` Junio C Hamano
2012-03-08  7:49     ` Jonathan Nieder
2012-03-08 22:52       ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F5A04BA.8030401@ira.uka.de \
    --to=hellmuth@ira.uka.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=nkreitzinger@gmail.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).