libgit2 / libgit2/pygit2

Merging leaves repo in "still merging" state

Open
#1,232 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the Bash and Python snippets, then inspect the r.merge and r.create_commit entry points and how they update merge state. Confirm the behavior with git status; done means the same commit flow no longer reports that the repository is still merging.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.