-
-
Notifications
You must be signed in to change notification settings - Fork 962
Fix creating references containing '@' #854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
tobiashenkel
wants to merge
1
commit into
gitpython-developers:master
from
tobiashenkel:fix-reference-containing-at
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix creating references containing '@'
References containing the '@' char are legal in git but fail with
[1]. This fails because as soon as '@' is encountered we stop
searching for a ref name, assume it is there and fail while retrieving
it. This can be fixed by catching this exception and continue with the
search for a valid ref.
[1] Trace:
Traceback (most recent call last):
File "/opt/zuul/lib/python3.7/site-packages/zuul/merger/merger.py", line 108, in __init__
self._ensure_cloned()
File "/opt/zuul/lib/python3.7/site-packages/zuul/merger/merger.py", line 178, in _ensure_cloned
repo.create_head(ref.remote_head, ref, force=True)
File "/opt/zuul/lib/python3.7/site-packages/git/repo/base.py", line 373, in create_head
return Head.create(self, path, commit, force, logmsg)
File "/opt/zuul/lib/python3.7/site-packages/git/refs/symbolic.py", line 546, in create
return cls._create(repo, path, cls._resolve_ref_on_create, reference, force, logmsg)
File "/opt/zuul/lib/python3.7/site-packages/git/refs/symbolic.py", line 497, in _create
target = repo.rev_parse(str(reference))
File "/opt/zuul/lib/python3.7/site-packages/git/repo/fun.py", line 211, in rev_parse
ref = name_to_object(repo, rev[:start], return_ref=True)
File "/opt/zuul/lib/python3.7/site-packages/git/repo/fun.py", line 142, in name_to_object
raise BadObject("Couldn't find reference named %r" % name)
gitdb.exc.BadObject: <unprintable BadObject object>- Loading branch information
commit c57ef1f408dd787386121a4fa569f230424c0b1e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better solution might be to stop treating
@as special outside of the spots that it is allowed in.I am a hesitant to let it make assumptions unless there absolutely is no other way. Or in other words, I believe the
gitorCimplementation is deterministic hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback, I'll try it when I have time in the next weeks.