You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
@Byron Yeah, I had assumed something similar to that was happening, due to the fact that ref.delete() was trying to run a git branch command. Thanks for taking a look and confirming!
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.
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 berefs/tags/new_tag
. When I runref.delete(repo, ref)
(whereref
is thegit.RemoteReference
andrepo
is its correspondinggit.Repo
instance), I get the following exception:Additionally,
ref.name
is set torefs/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.
The text was updated successfully, but these errors were encountered: