This issue was discovered in pygit2 libgit2/pygit2#754 and there are some pretty detailed reproduction steps there.
Reproductions steps
Create a patch object from at least one blob. Free the blob. Print the patch to a buffer. The patch will be mangled because the underlying blob was freed.
Expected behavior
A patch created from a blob should be able to print to a buffer without issue when the blob is freed.
In short, the patch should not need the blob to exist for it to print. The patch should hold a reference to the blob.
This issue was discovered in pygit2 libgit2/pygit2#754 and there are some pretty detailed reproduction steps there.
Reproductions steps
Create a patch object from at least one blob. Free the blob. Print the patch to a buffer. The patch will be mangled because the underlying blob was freed.
Expected behavior
A patch created from a blob should be able to print to a buffer without issue when the blob is freed.
In short, the patch should not need the blob to exist for it to print. The patch should hold a reference to the blob.