libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

crash on repo.head.rename() with single commit #1233

Closed dbungert closed 9 months ago

dbungert commented 10 months ago

I'm just poking around the library, I don't have a specific use case. Saw a segfault like follows:

FROM docker.io/library/ubuntu:mantic

RUN apt update
RUN apt install -y git python3-pygit2

RUN git config --global user.email "you@example.com"
RUN git config --global user.name "Your Name"
RUN git init
RUN touch foo
RUN git add foo
RUN git commit -m "add foo"
RUN python3 -c \
    "import pygit2; repo = pygit2.Repository('.'); repo.head.rename('b1')"

debian:sid does the same.

jdavid commented 9 months ago

The fix has been released, thanks for reporting @dbungert !