<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>36260</bug_id>
          
          <creation_ts>2019-03-11 03:13:20 +0300</creation_ts>
          <short_desc>git rev-list is bad at detecting ancestors</short_desc>
          <delta_ts>2019-03-11 03:26:17 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>git-core</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ivan Zakharyaschev">imz</reporter>
          <assigned_to name="placeholder@altlinux.org">placeholder</assigned_to>
          <cc>glebfm</cc>
    
    <cc>ldv</cc>
    
    <cc>placeholder</cc>
    
    <cc>vt</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>179347</commentid>
    <comment_count>0</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-03-11 03:13:20 +0300</bug_when>
    <thetext>$ cd /gears/r/rpm-build.git/
$ git merge-base --is-ancestor 4.0.4-alt114 4.0.4-alt128 &amp;&amp; echo yes
yes
$ git rev-list 4.0.4-alt114 ^4.0.4-alt128 | wc -l
163
$ rpm -q git-core
git-core-2.19.2-alt1.x86_64

And this is also the method used in girar to detect an ancestor, which is broken (as we see) -- gb/gb-task-check-girar:76:

	if [ -z &quot;$(GIT_ALTERNATE_OBJECT_DIRECTORIES=&quot;${1-}&quot; git log -n1 --pretty=format:1 ^&quot;$new_id&quot; &quot;$old_id&quot;)&quot; ]; then

&quot;git log&quot; works the same as &quot;git rev-list&quot;:

$ git --no-pager log -n1 --pretty=format:1 ^4.0.4-alt128 4.0.4-alt114        
1

The expected correct result is an empty string.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>179348</commentid>
    <comment_count>1</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-03-11 03:19:10 +0300</bug_when>
    <thetext>(In reply to comment #0)
&gt; $ cd /gears/r/rpm-build.git/
&gt; $ git merge-base --is-ancestor 4.0.4-alt114 4.0.4-alt128 &amp;&amp; echo yes
&gt; yes
&gt; $ git rev-list 4.0.4-alt114 ^4.0.4-alt128 | wc -l
&gt; 163

Here is the minimal example (using tags) in this repo:

$ git rev-list 4.0.4-alt124 ^4.0.4-alt128 | wc -l
196
$ git rev-list 4.0.4-alt125 ^4.0.4-alt128 | wc -l
0
$ git rev-list 4.0.4-alt124 ^4.0.4-alt127 | wc -l
0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>179349</commentid>
    <comment_count>2</comment_count>
    <who name="Ivan Zakharyaschev">imz</who>
    <bug_when>2019-03-11 03:26:17 +0300</bug_when>
    <thetext>(In reply to comment #1)
&gt; (In reply to comment #0)
&gt; &gt; $ cd /gears/r/rpm-build.git/
&gt; &gt; $ git merge-base --is-ancestor 4.0.4-alt114 4.0.4-alt128 &amp;&amp; echo yes
&gt; &gt; yes
&gt; &gt; $ git rev-list 4.0.4-alt114 ^4.0.4-alt128 | wc -l
&gt; &gt; 163
&gt; 
&gt; Here is the minimal example (using tags) in this repo:
&gt; 
&gt; $ git rev-list 4.0.4-alt124 ^4.0.4-alt128 | wc -l
&gt; 196
&gt; $ git rev-list 4.0.4-alt125 ^4.0.4-alt128 | wc -l
&gt; 0
&gt; $ git rev-list 4.0.4-alt124 ^4.0.4-alt127 | wc -l
&gt; 0

The commit where this happens:

$ git rev-list 6d9d4fed64ef4d6763fffe5d72515fdb2427b417 ^4.0.4-alt128 | wc -l
0
$ git rev-list 6d9d4fed64ef4d6763fffe5d72515fdb2427b417^ ^4.0.4-alt128 | wc -l
196
$</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>