libgit2 / libgit2/pygit2

Cannot delete a remote with multiple fetch refspecs

Open
#939 0 comments 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

Steps to reproduce:

>>> import pygit2
>>> repo = pygit2.init_repository(".")
>>> repo.remotes.create("origin", "https://github.com/libgit2/pygit2.git")
>>> repo.remotes.add_fetch("origin", "refs/heads/master:refs/remotes/origin/master")
>>> repo.remotes.add_fetch("origin", "refs/tags/*:refs/tags/*")
>>> repo.remotes.delete("origin")
_pygit2.GitError, entry is not unique due to being a multivar

This is present in the latest release and I also saw it happen (though with different error text) in 0.27

There doesn't appear to be a viable workaround because the libgit2 function for deleting multivars in the config isn't exposed in pygit2. Otherwise I would have tried to remove the multiple fetch entries directly ahead of time and then delete the remote.

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

Start by reproducing the provided pygit2 snippet and inspect the remote deletion and configuration handling exposed by pygit2. The fix is complete when deleting a remote with multiple fetch refspecs succeeds without the multivar error, with a regression test covering the example.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.