Cherry woes

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

 



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
--
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]