git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Timothy Chen <tnachen@gmail.com>,
	git@vger.kernel.org, martin f krafft <madduck@debian.org>
Subject: Re: [PATCH] Allow multiple merges to invalid HEAD
Date: Sun, 3 Apr 2011 16:52:46 -0500	[thread overview]
Message-ID: <20110403215246.GA6332@elie> (raw)
In-Reply-To: <7vlizrg6ef.fsf@alter.siamese.dyndns.org>

(+cc: Martin, who also requested something like this long ago[1] iirc)
Hi,

The following is only about motivation; I'm ignoring the mechanics for
now.

Junio C Hamano wrote:

> What's the point of being able to do this in the first place?
>
> The _only_ reason "git pull $there $branch" into an unborn branch exists
> is because it feels like
>
> 	$ git clone $there $directory
>
> could be broken down as this command sequence:
>
> 	$ mkdir $directory
>         $ cd $directory
>         $ git init
>         $ git remote add origin $there
> 	$ git fetch
>         $ git pull $there ;# or "git merge origin/master"

I'm to blame for the suggestion, I'm afraid.  

I haven't wanted to be able to "git init && git remote add origin
$there && git fetch && git merge origin/topic-1 origin/topic-2" for a
long time, but there was a time (around 3 years ago, I think) I wanted
it a lot.

In fact I can't remember the details of why.  The facts I remember:

 - /etc was kept in a git repository managed by etckeeper;
 - history was not precious --- it was just a way of understanding the
   final result;
 - the user wasn't sure how to manage topic branches yet.  The usual
   workflow involved

    (1) cherry-picking each automatic commit to an appropriate topic
        branch and writing a sensible description
    (2) bundling the topic branches together with an octopus merge
    (3) diff-ing against the automatically committed latest state to
        see if anything was missing
    (4) force a push.

So I suspect my use case was "start with a bundle of these branches".
I could have (and did) used "git checkout -b" to grab the first one
and merged the rest, but somehow a merge into nothingness seemed more
intuitive.  Remember, this is before the days of checkout --orphan
and rebase -i --everything.

That said.

I doubt the above is a very compelling use case, to justify the
maintenance cost and easily explain in documentation.  I would find
something like the following more compelling:

	Currently git merge has a special case to "pull into
	emptiness", to support the following sequence of commands:

		git init repo
		cd repo
		git remote add origin $url
		git fetch origin
		git merge origin/master

	But it is very much a special case.  It does not support
	octopus merges, --squash, --stat, alternate strategies,
	or any of the rest of merge machinery.

	It would be more intuitive if the above features _did_ work
	where they make sense, and if this essentially worked as
	though performing an ordinary merge with merge base being an
	empty tree that is ancestor of everything.

	Here is a first step --- support for octopus merges.  It
	also makes it easier to support the others, by [...].

> It very much feels like
> "because I can make things more complex", not "because this is an often
> desired missing feature that is a major pain point".

Therefore a good goal would be to make this make the code more simple
at the same time as making the semantics so.

(But also: Tim, please don't feel attached to this topic if you're not
interested in it; there are many more out there.)

Thanks for some useful feedback.
Jonathan

[1] http://bugs.debian.org/432558

  reply	other threads:[~2011-04-03 21:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-03  6:46 [PATCH] Allow multiple merges to invalid HEAD Timothy Chen
2011-04-03  7:07 ` Junio C Hamano
2011-04-03 21:52   ` Jonathan Nieder [this message]
2011-04-03  8:08 ` Junio C Hamano
2011-04-03 22:22 ` Jonathan Nieder
2011-04-05  6:01   ` Timothy Chen

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=20110403215246.GA6332@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=madduck@debian.org \
    --cc=tnachen@gmail.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).