git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Andrew Pimlott <andrew@pimlott.net>
Cc: git <git@vger.kernel.org>
Subject: Re: git cherry not marking commits with equivalent upstream
Date: Thu, 1 Jul 2010 22:41:51 +0200	[thread overview]
Message-ID: <20100701204151.GA6354@atjola.homenet> (raw)
In-Reply-To: <1278012954-sup-3724@pimlott.net>

On 2010.07.01 12:38:45 -0700, Andrew Pimlott wrote:
> The documentation for git-cherry says it marks changes in the current
> checkout that have an "equivalent" change in the upstream branch.  It
> even says it's useful when feeding patches upstream by email instead of
> git, which is what I'm doing (with CVS instead of email).  But it
> doesn't seem to work for me.
> 
> I'll simulate cloning an upstream repo, creating and commiting a patch,
> then sending it via email upstream to have it applied there, then
> pulling the upstream commit (the upstream repo is a, mine is b):
> 
>     ~% mkdir a && cd a
>     ~/a% git init
>     Initialized empty Git repository in /home/andrew/a/.git/
>     ~/a% touch a
>     ~/a% git add a
>     ~/a% git commit -m 1
>     [master (root-commit) be4fa74] 1
>      0 files changed, 0 insertions(+), 0 deletions(-)
>      create mode 100644 a
>     ~/a% git clone . ../b && cd ../b
>     Initialized empty Git repository in /home/andrew/b/.git/
>     ~/b% echo test > a
>     ~/b% git add a
>     ~/b% git commit -m 2
>     [master 551e90a] 2
>      1 files changed, 1 insertions(+), 0 deletions(-)
>     ~/b% cd ../a
>     ~/a% echo test > a
>     ~/a% git add a
>     ~/a% git commit -m 3
>     [master bb13e6c] 3
>      1 files changed, 1 insertions(+), 0 deletions(-)
>     ~/a% cd ../b
>     ~/b% git pull
>     remote: Counting objects: 5, done.
>     remote: Total 3 (delta 0), reused 0 (delta 0)
>     Unpacking objects: 100% (3/3), done.
>     From /home/andrew/a/.
>        be4fa74..bb13e6c  master     -> origin/master
>     Merge made by recursive.
>     ~/b% cat a
>     test

pull = fetch + merge, so your history in "b" looks like this:

  2 (origin/master)
 / \
1   M (master)
 \ /
  3

So "2" is common to both branches and thus ignored by cherry. If you
just fetch instead of merging, you get the result you expected:

doener@atjola:b (master) $ git fetch 
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From /home/doener/y/a
   4815708..dfbbb81  master     -> origin/master

doener@atjola:b (master) $ git cherry
- 2544e5a7f5d6b545d9e24ba9dcac74861b0bf15c

But once I merge:
doener@atjola:b (master) $ git merge origin/master
Merge made by recursive.

doener@atjola:b (master) $ git cherry
+ 2544e5a7f5d6b545d9e24ba9dcac74861b0bf15c

Björn

  parent reply	other threads:[~2010-07-01 20:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 19:38 git cherry not marking commits with equivalent upstream Andrew Pimlott
2010-07-01 19:40 ` Andrew Pimlott
2010-07-01 20:41 ` Björn Steinbrink [this message]
2010-07-01 21:17   ` Andrew Pimlott
2010-07-01 21:09 ` [PATCH] Documentation: 'cherry' does not cope well with merges from upstream Jonathan Nieder
2010-07-01 21:33   ` Andrew Pimlott
2010-07-01 21:35   ` Jonathan Nieder
2010-07-01 23:52   ` Junio C Hamano
2010-07-02  0:51     ` Jonathan Nieder
2010-07-02  1:04   ` Jonathan Nieder
2010-07-02  7:46   ` Michael J Gruber
2010-07-02  8:18     ` Jonathan Nieder
2010-07-02  9:23       ` Michael J Gruber

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=20100701204151.GA6354@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=andrew@pimlott.net \
    --cc=git@vger.kernel.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.
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).