Subject: Re: rev-list with multiple commits sharing same patch-id

From: Arnaud Morin <[email-masked]>
Date: Mon, 11 Jan 2021 07:59:05 +0000

Sorry, forgot to mention 2 things:
- I am using latest stable git version (2.30)
- I my previous mail, my git diff was against branch B:
$ git diff B
(empty)

Thanks

-- 
Arnaud Morin

On 09.01.21 - 16:24, Arnaud Morin wrote:
> Hey all,
> 
> I am struggling with a rev-list command, hope someone can give me a
> clue on what is going on.
> 
> I have 2 branches:
> $ git branch
>   B
> * master
> 
> Currently on master, there is not diff against B:
> $ git diff
> (empty)
> 
> The commits in B are cherry-picked from master.
> Here is the graph:
> $ git log --graph --oneline --all
> * ae2e3c4 (origin/B, B) remove line2 and add line4 (bis)
> * a7a0339 remove line4
> * caa4aad restore line2
> * d7dc596 remove line2 add line4
> * 44bcfd4 add line3
> * e372641 b
> | * dbf86d8 (HEAD -> master, origin/master) remove line2 and add line4 (bis)
> | * 4017282 remove line4
> | * 0f2a449 restore line2
> | * 8969d3f remove line2 add line4
> | * e73b420 add line3
> | * fe5a75a b
> |/  
> * 6192505 a
> * b4089e1 init
> 
> 
> However, when using git rev-list to perform a symmetric difference, git
> is giving me a commit ID:
> $ git rev-list --left-right --cherry-pick B...master
> >dbf86d8aafc897a25a3093139b4237a62395041e
> 
> Note that this commit is not empty
> $ git show dbf86d8aafc897a25a3093139b4237a62395041e --stat
> commit dbf86d8aafc897a25a3093139b4237a62395041e (origin/master, master)
> Author: Arnaud Morin <hidden@mail>
> Date:   Sat Jan 9 10:30:10 2021 +0100
> 
>     remove line2 and add line4 (bis)
> 
>  a | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> 
> So, from git rev-list perspective, there is a diff.
> 
> After digging a little bit, the thing is that this commit is having the
> following patch-id:
> $ git show dbf86d8aafc897a25a3093139b4237a62395041e | git patch-id
> 20f4ace68e80a751b07d78a27c94e83d6c5314bc dbf86d8aafc897a25a3093139b4237a62395041e
> 
> Which is also already existing in an other commit:
> $ for c in $(git rev-list HEAD) ; do git show $c |git patch-id |grep 20f4ace68e80a751b07d78a27c94e83d6c5314bc; done
> 20f4ace68e80a751b07d78a27c94e83d6c5314bc dbf86d8aafc897a25a3093139b4237a62395041e
> 20f4ace68e80a751b07d78a27c94e83d6c5314bc 8969d3fa9159730fd3b23199873bfb26e3d20027
> 
> So, is it normal that rev-list is not able to figure out that a commit
> is existing in both branch when 2 commits share the same patch-id?
> 
> Is there any way to prevent rev-list from showing this commit?
> 
> Thanks for your help.
> 
> 
> PS. I have uploaded my test repo here:
> https://gitlab.com/arnaudmorin/git-rev-list
> 
> 
> -- 
> Arnaud Morin
>