Skip to content

Parse rejected deletes. #929

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

Merged
merged 1 commit into from
Sep 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion git/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ def _from_line(cls, remote, line):
if flags & cls.DELETED:
from_ref = None
else:
from_ref = Reference.from_path(remote.repo, from_ref_string)
if from_ref_string == "(delete)":
from_ref = None
else:
from_ref = Reference.from_path(remote.repo, from_ref_string)

# commit handling, could be message or commit info
old_commit = None
Expand Down
8 changes: 8 additions & 0 deletions git/test/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,14 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
progress.make_assertion()
self._do_test_push_result(res, remote)

# rejected stale delete
force_with_lease = "%s:0000000000000000000000000000000000000000" % new_head.path
res = remote.push(":%s" % new_head.path, force_with_lease=force_with_lease)
self.assertTrue(res[0].flags & PushInfo.ERROR)
self.assertTrue(res[0].flags & PushInfo.REJECTED)
self.assertIsNone(res[0].local_ref)
self._do_test_push_result(res, remote)

# delete new branch on the remote end and locally
res = remote.push(":%s" % new_head.path)
self._do_test_push_result(res, remote)
Expand Down