libgit2 / pygit2

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

Merging leaves repo in "still merging" state #1232

Open meowcat opened 10 months ago

meowcat commented 10 months ago

After executing a merge as suggested in the docs, a git status suggests that "you are still merging".

Bash:

git init mergable
cd mergable
echo a > a
git add .
git commit -m "initial"
git switch -c mergy
echo b > b
git add b
git commit -m "additional"
git switch master
cd ..
git clone mergable mergable-clone

Python:

import pygit2
r = pygit2.Repository("mergable-clone")
mergy = r.references["refs/remotes/origin/mergy"]
parents = [r.head.target, mergy.target]
r.merge(mergy.target)

r.create_commit(
    "HEAD",
    pygit2.Signature("aaa", "mergy@merge.ch"),
    pygit2.Signature("aaa", "mergy@merge.ch"),
    "merge",
    r.index.write_tree(),
    parents
)

Bash:

cd mergable-clone
git status

Returns:

On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)

All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Another git commit silences the message.

meowcat commented 10 months ago

Oh, it's a duplicate of #1081. The behaviour is fine, but it would be great if this was documented in the docs.