Closed
Description
I am attempting to use GitPython to remove a tag from a local clone which does not exist in the remote repo. After fetching a remote, remote.stale_refs shows the following stale tag: <git.RemoteReference "refs/remotes/refs/tags/new_tag">
. This already seems to be a problem, as the path to the tag should be refs/tags/new_tag
. When I run ref.delete(repo, ref)
(where ref
is the git.RemoteReference
and repo
is its corresponding git.Repo
instance), I get the following exception:
GitCommandError: 'git branch -d -r refs/tags/new_tag' returned exit status 1: error: remote branch 'refs/tags/new_tag' not found.
Additionally, ref.name
is set to refs/tags/new_tag
, so at least that much looks correct.
My GitPython version is 0.3.2.1. I have not yet had a chance to test with a newer version.
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
terminalmage commentedon Feb 20, 2015
In the meantime, I can work around this by running
repo.git.tag('-d', 'new_tag')
.Byron commentedon Feb 20, 2015
Thanks for bringing this up.
Even though I didn't reproduce it yet, it seems that
stale_refs
is getting the category of returned refs totally wrong, and thus handles tags as branches. The code indicates that as well.terminalmage commentedon Feb 20, 2015
@Byron Yeah, I had assumed something similar to that was happening, due to the fact that
ref.delete()
was trying to run agit branch
command. Thanks for taking a look and confirming!Byron commentedon Feb 21, 2015
Please note that I was unable to reproduce the issue, despite doing my best to achieve that.
The code was adjusted anyway to allow returning specialised references as well though.
Please give it a whirl and let me know if something else is wrong with it.
terminalmage commentedon Feb 23, 2015
Thanks, I'll install from git on Monday or Tuesday and test.