git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cherry woes
@ 2009-05-12 13:15 Michael J Gruber
  2009-05-12 17:57 ` Avery Pennarun
  0 siblings, 1 reply; 2+ messages in thread
From: Michael J Gruber @ 2009-05-12 13:15 UTC (permalink / raw)
  To: Git Mailing List

Hi there

I encountered a misfeature of cherry or misuse of it by myself... Also,
the behaviour is not quite what the doc suggests. The script below
generates the following DAG:

*   05f4f8c (refs/heads/master) Merge branch 'upstream'
|\
| * 2c8fad1 (refs/heads/upstream) add a
* | df7b5e4 Add a
|/
* 6bdebf5 init

Naively, one would say that master and upstream contain one commit each
which differ but their patch-ids coincide (see below). That's the same
situation before as well as after the merge.

But calling "git cherry -v upstream" when on the master branch gives
different results:

Before merge:
- df7b5e472d9a23d02943b331a7dc9ec638f44b33 Add a
Merge made by recursive.
After merge:
+ df7b5e472d9a23d02943b331a7dc9ec638f44b33 Add a

Of course master contains both 2c8fad1 and df7b5e4, and upstream only
the latter (Did I say "naively"?). But still upstream contains a commit
which is patch-equivalent to 2c8fad1, and which git cherry does not find.

The point is that "git cherry upstream head" looks at each commit in
upstream..head and checks whether there is an equivalent patch in
head..upstream. (This differs from the doc which says fork-point..head
resp. fork-point..upstream.)

In the DAG above, all is well when head is master^ (df7b5e4), i.e.
before the merge, but head..upstream is empty after the merge.

Now, adjusting the doc is easy, but I still feel that cherry does not
give the most useful info in the situation at hand. But how would I find
a better lower boundary for the range ..upstream? merge-base of master
and upstream is upstream so that doesn't cut it. So I'm wondering what
the right approach is and whether anyone cares.

Michael

--->%---
#!/bin/bash

rm -Rf cherrybug
mkdir cherrybug && cd cherrybug && git init
echo a > a && git add a && git commit -m init
git checkout -b upstream
echo b >> a && git add a && git commit -m "add a"
git checkout master
echo b >> a && git add a && git commit -m "Add a"
echo "Before merge:"
git cherry -v upstream
git merge upstream
echo "After merge:"
git cherry -v upstream

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-12 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-12 13:15 Cherry woes Michael J Gruber
2009-05-12 17:57 ` Avery Pennarun

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).