git cherry not marking commits with equivalent upstream
- From
- Andrew Pimlott <andrew@pimlott.net>
- Date
- Jul 1, 2010, 19:38 UTC
- Message-ID
- <1278012954-sup-3724@pimlott.net>
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
testNow, I think I have two equivalent commits in repo b, one of which came from repo a (upstream). So I expect git-cherry to show the other commit with a '-' instead of a '+'. But no:
~/b% git log
commit 27158bb3e5f7cf80a43eb7364a735f16c43e447c
Merge: 551e90a bb13e6c
Author: Andrew Pimlott <andrew@pimlott.net>
Date: Thu Jul 1 12:25:21 2010 -0700Merge branch 'master' of /home/andrew/a/.
commit bb13e6cea3a27a4450984b6d1d87f13d807d2d36
Author: Andrew Pimlott <andrew@pimlott.net>
Date: Thu Jul 1 12:25:18 2010 -07003
commit 551e90ac390a2a27152661b9cbe73845d237e008
Author: Andrew Pimlott <andrew@pimlott.net>
Date: Thu Jul 1 12:25:06 2010 -07002
commit be4fa741476176181947e96c5242003ffe4f4183
Author: Andrew Pimlott <andrew@pimlott.net>
Date: Thu Jul 1 12:24:42 2010 -0700 1
~/b% git show bb13e6cea3a27a4450984b6d1d87f13d807d2d36 | git patch-id
58105e2bbccf2799f480bf82bb76467ff0301c52 bb13e6cea3a27a4450984b6d1d87f13d807d2d36
~/b% git show 551e90ac390a2a27152661b9cbe73845d237e008 | git patch-id
58105e2bbccf2799f480bf82bb76467ff0301c52 551e90ac390a2a27152661b9cbe73845d237e008
~/b% git cherry
+ 551e90ac390a2a27152661b9cbe73845d237e008Is my undestanding of how this should work wrong? Is there any way to get the result I want?
Andrew (Please Cc me on replies)