Bug 1469187

Summary: 0013533: pygit2/libgit2 incorrect results while diff'ing 2 commits
Product: [Fedora] Fedora EPEL Reporter: Carlos Mogas da Silva <r3pek>
Component: python-pygit2Assignee: Pete Walter <walter.pete>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: high    
Version: epel7CC: i, ignatenko, infra-sig, walter.pete
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-pygit2-0.26.4-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-05-17 12:42:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Carlos Mogas da Silva 2017-07-10 15:56:13 UTC
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
[3eb85cf73301596254d9ea4b55dfe720727c6985]
>>> diff = repo.diff(obj.parents[0],obj)
>>> diff.patch

Actual results:
None

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 16:02:35 UTC
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 16:07:57 UTC
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 15:40:29 UTC
Just an additional info, it has the same behaviour on pagure.io:

https://pagure.io/Pharmacies/c/c26c5411a206bc87cc7a4f5b8303b6e9af951b72?branch=master

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

Comment 5 Fedora Update System 2018-05-02 02:18:23 UTC
python-pygit2-0.26.4-1.el7 libgit2-0.26.3-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-5ae7f0e7c7

Comment 6 Fedora Update System 2018-05-02 09:31:00 UTC
libgit2-0.26.3-1.el7, python-pygit2-0.26.4-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2018-5ae7f0e7c7

Comment 7 Fedora Update System 2018-05-17 12:42:46 UTC
libgit2-0.26.3-1.el7, python-pygit2-0.26.4-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.