Bug 1469187 - 0013533: pygit2/libgit2 incorrect results while diff'ing 2 commits
0013533: pygit2/libgit2 incorrect results while diff'ing 2 commits
Status: NEW
Product: Fedora EPEL
Classification: Fedora
Component: python-pygit2 (Show other bugs)
x86_64 Linux
high Severity medium
: ---
: ---
Assigned To: Pete Walter
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2017-07-10 11:56 EDT by Carlos Mogas da Silva
Modified: 2017-11-20 02:54 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Carlos Mogas da Silva 2017-07-10 11:56:13 EDT
Description of problem:
I setup a private pagure instance on my CentOS server.
After importing my projects, I noticed that some of the commits where not showing the diffs and after talking to pagure devs on IRC I decided to investigate further.
After trying the code by hand on a python shell, I was able to reproduce the problem with no issues at all and eveytime.

Version-Release number of selected component (if applicable): 0.24.2

How reproducible: Everytime

Steps to Reproduce:
You can totally use my repo for testing.

- git clone https://code.r3pek.org/r3pek/Pharmacies.git
- cd Pharmacies
- python2
>>> from pygit2 import Repository
>>> repo = Repository(".")
>>> obj = repo.get("c26c5411a206bc87cc7a4f5b8303b6e9af951b72")
>>> obj.parent_ids #Just to confirm they're there
>>> diff = repo.diff(obj.parents[0],obj)
>>> diff.patch

Actual results:

Expected results:
The actual diff patch

Additional info:
I tested the same thing on my dev box running Archlinux and pygit2 version 0.25.1 and it works.
Comment 1 Igor Gnatenko 2017-07-10 12:02:35 EDT
In [1]: from pygit2 import Repository

In [2]: repo = Repository(".")

In [3]: obj = repo.get("c26c5411a206bc87cc7a4f5b8303b6e9af951b72")

In [4]: obj.parent_ids #Just to confirm they're there
Out[4]: [3eb85cf73301596254d9ea4b55dfe720727c6985]

In [5]: diff = repo.diff(obj.parents[0],obj)

In [6]: diff.patch
Out[6]: 'diff --git a/src/org/r3pek/pharmacies/PharmacyInfo.java b/src/org/r3pek/pharmacies/PharmacyInfo.java\nindex cef96af..658d28e 100644\n--- a/src/org/r3pek/pharmacies/PharmacyInfo.java\n+++ b/src/org/r3pek/pharmacies/PharmacyInfo.java\n@@ -1,7 +1,5 @@\n package org.r3pek.pharmacies;\r\n \r\n-import com.admob.android.ads.AdView;\r\n-\r\n import org.r3pek.pharmacies.utils.GeoUtils;\r\n import org.r3pek.pharmacies.utils.GlobalVars;\r\n import org.r3pek.pharmacies.widgets.Arrow;\r\n@@ -75,8 +73,6 @@ public class PharmacyInfo extends Activity {\n \tpublic void onPause() {\r\n \t\tarrowChangerSensor.delImage((Arrow)findViewById(R.id.ivInfoDirection));\r\n     \tsm.unregisterListener(arrowChangerSensor);\r\n-    \tAdView ad = (AdView) findViewById(R.id.ad);\r\n-    \tad.cleanup();\r\n     \tsuper.onPause();\r\n \t}\r\n \t\r\n'

Works here on Fedora (not EPEL).
Comment 2 Carlos Mogas da Silva 2017-07-10 12:07:57 EDT
repoquery -i python-pygit2

Name        : python-pygit2
Version     : 0.24.2
Release     : 1.el7
Architecture: x86_64
Size        : 681821
Packager    : Fedora Project
Group       : Unspecified
URL         : http://www.pygit2.org
Repository  : epel
Summary     : Python 2.x bindings for libgit2
Source      : python-pygit2-0.24.2-1.el7.src.rpm
Description :
pygit2 is a set of Python bindings to the libgit2 library, which implements
the core of Git.

Maybe this is specific for the EPEL version?
Comment 3 Carlos Mogas da Silva 2017-07-11 11:40:29 EDT
Just an additional info, it has the same behaviour on pagure.io:

Comment 4 Igor Gnatenko 2017-11-20 02:54:58 EST
pygit2 stack is outdated on EL7, so most likely...

Note You need to log in before you can comment on or make changes to this bug.