all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Engster <deng@randomsample.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: master c6f03ed: Fix a problem in url.el without GnuTLS
Date: Sun, 14 Dec 2014 00:13:20 +0100	[thread overview]
Message-ID: <874mszp2i7.fsf@engster.org> (raw)
In-Reply-To: <83sigj48z5.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 13 Dec 2014 21:59:10 +0200")

[-- Attachment #1: Type: text/plain, Size: 3121 bytes --]

Eli Zaretskii writes:
>> From: David Engster <deng@randomsample.de>
>> Cc: emacs-devel@gnu.org
>> Date: Sat, 13 Dec 2014 20:44:18 +0100
>> 
>> When you rebase a commit, it becomes a new one. Therefore, you can only
>> safely rebase "local" commits (meaning: commits only *you* have).
>
> If "safely" here means "while preserving the commit's sha1", then it's
> quite obvious.  But why would that matter in this scenario?  And why
> does that cause the merged versions appear as if they were not merged
> at all, even when rebase=preserve was/is used?

I think we really have to discuss this on an actual example. I've
attached a small script which will create three directories underneath a
directory called "MERGE_REBASE_TEST": 'upstream', 'ted' and 'eli'. There
are two branches, 'master' and 'stable', which Ted sets up and pushes. I
put some sleeps in there just so that the commits have different time
stamps.

Ted merges 'stable' into 'master', but does not push yet. Then Eli makes
a new commit on 'master' and pushes. This is where the script ends.

Now go to 'ted' and do 'gitk --all' to see the situation. If you try to
push with 'git push origin master', then this will fail because there's
this new commit from Eli. Now do 'git pull --rebase=preserve', and then
again do 'gitk --all'. You'll see that the 'stable' branch was rebased
onto 'origin/master'. This changed the SHA1 of those two commits on
'stable', as they now descend from a different parent. You *have* a
merge, but it is *not* a merge from origin/stable, but from a new
(unnamed) branch that was created by rebasing origin/stable.

Simply delete the MERGE_REBASE_TEST directory and run the script again
to try the alternatives for Ted. 'git pull --rebase' will do the same as
'--rebase=preserve' but will simply drop the merge commit ("flatten the
history"). Again, this will *not* merge the two commits from
origin/stable (a 'git log stable ^master' will list all commits that are
in stable but not in master).

If you simply do 'git pull', this will merge origin/master into your
tree. If you push this, everything will be OK. The above log command
will show nothing, just as it should after a succesful merge.

> I didn't say I want to have the same merge.  All I want is to have
> _some_ indication there was a merge from the other branch, including
> when that branch is a public branch.  You seem to say it's not
> possible with Git.

You can't at the same time move a branch onto a new parent (which is
what rebase does) and then merge it, so that it looks like you've merged
the original one which had another parent.

> Sorry, I still don't understand.  Which commits from what branches
> does Git merge after 'rebase=preserve'?

It merges the branch that is implicitly created by moving
'origin/emacs-24' to a newer parent.

> And how do conflicts enter this picture?  Suppose there were no
> conflicts at all during the original merge -- would the merge still
> disappear after 'rebase=preserve'?

I guess it's better to forget conflicts. I was hoping it would make
clearer how rebase works, but it just complicates things.

-David


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: merge-rebase-test.sh --]
[-- Type: text/x-sh, Size: 993 bytes --]

#!/bin/sh

mkdir MERGE_REBASE_TEST
cd MERGE_REBASE_TEST

# Create bare upstream
mkdir upstream
cd upstream
git init --bare
cd ..
# Ted clones, creates two commits on master and pushes.
git clone upstream ted
cd ted
echo "bla" > foo
git add foo
sleep 2
git commit -a -m "first commit on master"
echo "bla2" >> foo
sleep 2
git commit -a -m "second commit on master"
git push origin master
# Ted now creates branch 'stable' with two commits and pushes.
git checkout -b stable
echo "bla" > bar
git add bar
sleep 2
git commit -a -m "commit to stable 1"
echo "bla2" >> bar
sleep 2
git commit -a -m "commit to stable 2"
git push origin stable
# Ted goes back to master and merges 'origin/stable', but does NOT push.
git checkout master
sleep 2
git merge --no-ff origin/stable -m "merge stable"
cd ..
# Eli clones, creates new commit on master and pushes
git clone upstream eli
cd eli
git checkout master
echo "bla3" >> foo
sleep 2
git commit -a -m "New commit on master"
git push origin master
cd ..

  parent reply	other threads:[~2014-12-13 23:13 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141211155740.11916.1584@vcs.savannah.gnu.org>
     [not found] ` <E1Xz67Y-00036o-Vf@vcs.savannah.gnu.org>
2014-12-11 16:47   ` master c6f03ed: Fix a problem in url.el without GnuTLS Leo Liu
2014-12-11 18:08     ` Eli Zaretskii
2014-12-11 23:00       ` Ted Zlatanov
2014-12-12  9:23         ` Eli Zaretskii
2014-12-12 13:24           ` Ted Zlatanov
2014-12-12 14:28             ` Eli Zaretskii
2014-12-12 16:06               ` Stefan Monnier
2014-12-13  0:25               ` Ted Zlatanov
2014-12-13  0:28                 ` Lars Magne Ingebrigtsen
2014-12-13  1:25                 ` Ted Zlatanov
2014-12-13  8:04                 ` Eli Zaretskii
2014-12-13 10:16                   ` David Engster
2014-12-18 22:38                     ` David Engster
2014-12-19  8:50                       ` Eli Zaretskii
2014-12-13  9:04                 ` David Engster
2014-12-13  9:50                   ` David Engster
2014-12-13 13:19                     ` Ted Zlatanov
2014-12-13 14:13                       ` David Engster
2014-12-13 14:25                         ` Ted Zlatanov
2014-12-13 15:18                         ` Eli Zaretskii
2014-12-13 19:44                           ` David Engster
2014-12-13 19:59                             ` Eli Zaretskii
2014-12-13 22:00                               ` Dmitry Gutov
2014-12-14  3:36                                 ` Eli Zaretskii
2014-12-13 23:13                               ` David Engster [this message]
2014-12-14 16:09                                 ` Eli Zaretskii
2014-12-14 16:37                                   ` Ted Zlatanov
2014-12-14 16:55                                     ` Eli Zaretskii
2014-12-14 17:00                                       ` Ted Zlatanov
2014-12-14 23:21                                     ` Stefan Monnier
2014-12-14 17:46                                   ` Paul Eggert
2014-12-14 17:50                                     ` Eli Zaretskii
2014-12-14 18:28                                     ` Ted Zlatanov
2014-12-14 19:41                                       ` David Engster
2014-12-14 21:40                                   ` David Engster
2014-12-15  3:47                                     ` Eli Zaretskii
2014-12-15 20:39                                       ` David Engster
2014-12-16 19:42                                         ` Eli Zaretskii
2014-12-17  9:58                                           ` Steinar Bang
2014-12-17 10:52                                             ` Steinar Bang
2014-12-17 15:36                                               ` Eli Zaretskii
2014-12-17 15:35                                             ` Eli Zaretskii
2014-12-17 20:37                                           ` David Engster
2014-12-18  4:55                                             ` Stephen J. Turnbull
2014-12-18 15:39                                               ` Eli Zaretskii
2014-12-18 20:00                                                 ` Steinar Bang
2014-12-18 20:40                                                   ` Eli Zaretskii
2014-12-19  8:09                                                     ` Steinar Bang
2014-12-19  9:16                                                       ` Eli Zaretskii
2014-12-19 10:33                                                         ` Steinar Bang
2014-12-18 21:18                                               ` David Engster
2014-12-18 15:38                                             ` Eli Zaretskii
2014-12-18 19:46                                               ` Steinar Bang
2014-12-18 20:35                                                 ` Eli Zaretskii
2014-12-19  6:07                                                   ` Yuri Khan
2014-12-19  7:57                                                     ` Steinar Bang
2014-12-19  9:09                                                     ` Eli Zaretskii
2014-12-18 20:46                                               ` David Engster
2014-12-14 22:42                                   ` Stefan Monnier
2014-12-15  3:37                                     ` Eli Zaretskii
2014-12-15  4:46                                       ` Stefan Monnier
2014-12-12 20:46             ` Lars Magne Ingebrigtsen
2014-12-12  0:30       ` Leo Liu

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=874mszp2i7.fsf@engster.org \
    --to=deng@randomsample.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.