In some cases pygit2.Repository.diff() returns no difference between trees that are actually different

Bug #1695049 reported by Robie Basak
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-pygit2 (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Steps to reproduce:

git clone https://git.launchpad.net/~racb/+git/pygit2-tree-compare-bug
cd pygit2-tree-compare-bug
python3
import pygit2
r = pygit2.Repository('.')
tag1 = r.get('12f94a0b8488844522310b9eda9cbf183e24d7ab')
tag2 = r.get('bee50a71086cf4ae8f74fe9f0690404caf280d5e')
len(r.diff(tag1, tag2))

Expected result: non-zero
Actual result: zero (0)

This differs from reality. "git diff 12f94a0b8488844522310b9eda9cbf183e24d7ab bee50a71086cf4ae8f74fe9f0690404caf280d5e" does produce results. If I peel the Tag objects to Tree objects, these present the same (different) ids as <hash>^{tree} on the git command line. If I fetch the tree objects by their hashes directly using r.get(), the problem does not appear to occur.

I'm using python3-pygit2 0.24.0-0ubuntu2 on Ubuntu 16.04.

Revision history for this message
Robie Basak (racb) wrote :

Also affects python3-pygit2 0.24.2-2build1 on Artful.

Does not affect pygit2 built from upstream master (commit c6305a062ba190fa4b968614911f0def752cc264) against libgit2 upstream git tag v0.25.1 (commit 2fcb8705e584ca61f6c4657525c9d2713f6a39d2). Current libgit2 upstream git master builds some v0.26 soname against which current pygit2 master refuses to build.

Revision history for this message
Robie Basak (racb) wrote :

I'm leaving this bug for now. It's valid, but we have a trivial workaround for what we need (compare the hashes directly) and it looks like this doesn't affect today's upstream so it should get fixed in the Ubuntu development release in the end with no specific action.

Timo Röhling (roehling)
Changed in python-pygit2 (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.