From: Francis Moreau <francis.moro@gmail.com>
To: Kevin Daudt <me@ikke.info>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git-cherry doesn't detect a "copied" commit
Date: Fri, 23 Oct 2015 14:24:18 +0200 [thread overview]
Message-ID: <CAC9WiBjub2oBBaM7KxcE2Jv7QgGyvmPzEBU7WcSEk5huGzx+zg@mail.gmail.com> (raw)
In-Reply-To: <20151023105756.GB12622@ikke.info>
On Fri, Oct 23, 2015 at 12:57 PM, Kevin Daudt <me@ikke.info> wrote:
> On Tue, Oct 20, 2015 at 06:32:12PM +0200, Francis Moreau wrote:
>> Hi,
>>
>> I'm seeing something odd with git-cherry: it doesn't seem to detect
>> that a commit has been cherry-picked from master branch.
>>
>> This happens with the systemd git repository (from github) so it
>> should be fairly simple to reproduce.
>>
>> What I did:
>>
>> $ git --version
>> git version 2.6.0
>> $ git checkout -b foo v210
>> $ git cherry-pick -x 9ea28c55a2488e6cd4a44ac5786f12b71ad5bc9f
>> $ git branch --contains 9ea28c55a2488e6cd4a44ac5786f12b71ad5bc9f
>> master
>> $ git cherry master HEAD
>> + fef60bf34d1b372bea1db2515a8d936386dfc523
>>
>> so git-cherry tells me that the cherry-picked commit has not
>> equivalent in master, which is no the case.
>>
>> What am I missing ?
>>
>
> Let's see:
>
> $ git show | git patch-id
> 50c9f9548e1fd25401ff9540c82c1d5f9723c3d5 b4c86d2965aaf0736e4ab30be1d1a08931009a08
>
> $ git show 9ea28c55a2488e6cd4a44ac5786f12b71ad5bc9f | git patch-id
> a5cfbb542882bd9cbe192b43026354d1f2741673 9ea28c55a2488e6cd4a44ac5786f12b71ad5bc9f
>
> Git patch-id calculates the hash over the diff, and, when gives in this
> case two hashes, first the patch-id and the second the commit hash.
>
> The patch-ids are different, explaining why git cherry does not see them
> as equivalent. If I take a diff of the diff, I notice something:
>
> diff --git a/src/udev/udevadm-settle.c b/src/udev/udevadm-settle.c
> -index 927ea2a..65fc35f 100644
> +index b026155..ea9b078 100644
> --- a/src/udev/udevadm-settle.c
> +++ b/src/udev/udevadm-settle.c
> @@ -41,42 +41,28 @@
> @@ -1094,7 +1094,7 @@
> exit(EXIT_SUCCESS);
> @@ -102,44 +85,13 @@ static int adm_settle(struct udev *udev, int argc, char *argv[])
> default:
> - assert_not_reached("Unknown argument");
> + assert_not_reached("Unkown argument");
> }
> + }
>
> If you look at the lines with assert_not_reached, it seems there is a
> difference in the context of both diffs, causing the diffs to be
> different.
>
> Hope this helps, Kevin
Thanks Kevin
I was mislead by the git-cherry manpage somehow which says:
"git-cherry therefore
detects when commits have been "copied" by means of git-cherry-pick(1),
which is not exactly true.
Isn't there a way to get git-cherry less "strict" ?
I mean in this case most of 90% of the diff is the same, only one line
of context is not identical...
Would it make sense to add a "--fuzz" option which would reduce the
diff context area used to generate the hash ?
Thanks.
--
Francis
next prev parent reply other threads:[~2015-10-23 12:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 16:32 git-cherry doesn't detect a "copied" commit Francis Moreau
2015-10-23 6:47 ` Francis Moreau
2015-10-23 10:57 ` Kevin Daudt
2015-10-23 12:24 ` Francis Moreau [this message]
2015-10-23 22:41 ` Junio C Hamano
2015-10-29 14:44 ` Francis Moreau
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=CAC9WiBjub2oBBaM7KxcE2Jv7QgGyvmPzEBU7WcSEk5huGzx+zg@mail.gmail.com \
--to=francis.moro@gmail.com \
--cc=git@vger.kernel.org \
--cc=me@ikke.info \
/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).