Skip to content

Conversation

brandonio21
Copy link
Contributor

Fixes #754 and also allows merging of #758 .

As described in #754, Patch objects do not have a reference to their underlying blobs. Thus, if the blob is freed before patch text is generated, the patch text becomes mangled. This is ultimately an issue in libgit2 and the issue is being tracked in libgit2/libgit2#4442

In the meantime, the problem can be solved at the pygit2 level. This PR adds blob references to the pygit2 Patch objects and increments their reference counters when a patch with blobs is generated.

When the fix is ultimately merged into libgit2, this behavior should probably be removed from pygit2. Until then, this is a good fix!

@jdavid jdavid merged commit c0eaa69 into libgit2:master Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Patch does not have a reference to underlying blob(s)
2 participants