@@ -455,16 +455,28 @@ def stale_refs(self):
455455 remote side, but are still available locally.
456456
457457 The IterableList is prefixed, hence the 'origin' must be omitted. See
458- 'refs' property for an example."""
458+ 'refs' property for an example.
459+
460+ To make things more complicated, it can be possble for the list to include
461+ other kinds of references, for example, tag references, if these are stale
462+ as well. This is a fix for the issue described here:
463+ https://github.com/gitpython-developers/GitPython/issues/260
464+ """
459465out_refs = IterableList (RemoteReference ._id_attribute_ ,"%s/" % self .name )
460466for line in self .repo .git .remote ("prune" ,"--dry-run" ,self ).splitlines ()[2 :]:
461467# expecting
462468# * [would prune] origin/new_branch
463469token = " * [would prune] "
464470if not line .startswith (token ):
465471raise ValueError ("Could not parse git-remote prune result: %r" % line )
466- fqhn = "%s/%s" % (RemoteReference ._common_path_default ,line .replace (token ,"" ))
467- out_refs .append (RemoteReference (self .repo ,fqhn ))
472+ ref_name = line .replace (token ,"" )
473+ # sometimes, paths start with a full ref name, like refs/tags/foo, see #260
474+ if ref_name .startswith (Reference ._common_path_default + '/' ):
475+ out_refs .append (SymbolicReference .from_path (self .repo ,ref_name ))
476+ else :
477+ fqhn = "%s/%s" % (RemoteReference ._common_path_default ,ref_name )
478+ out_refs .append (RemoteReference (self .repo ,fqhn ))
479+ # end special case handlin
468480# END for each line
469481return out_refs
470482