Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3236f8b

Browse files
committed
stale_refs() may now also handle other kinds of references, like tags.
Fixesgitpython-developers#260
1 parente0acb83 commit3236f8b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎git/remote.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
"""
459465
out_refs=IterableList(RemoteReference._id_attribute_,"%s/"%self.name)
460466
forlineinself.repo.git.remote("prune","--dry-run",self).splitlines()[2:]:
461467
# expecting
462468
# * [would prune] origin/new_branch
463469
token=" * [would prune] "
464470
ifnotline.startswith(token):
465471
raiseValueError("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+
ifref_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
469481
returnout_refs
470482

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp