Backported upstream patch from https://github.com/libgit2/libgit2/pull/6713 Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>