Re: git cherry not marking commits with equivalent upstream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]