summaryrefslogtreecommitdiff
path: root/git
diff options
context:
space:
mode:
authorUri Baghin <uri@canva.com>2019-09-29 00:57:10 +1000
committerSebastian Thiel <sebastian.thiel@icloud.com>2019-09-28 18:16:52 +0200
commitfdb1dc77a45a26d8eac9f8b53f4d9200f54f7efe (patch)
treef82e27d0c3273379424867c7211ba3d7fc39c259 /git
parent359a7e0652b6bf9be9200c651d134ec128d1ea97 (diff)
downloadgitpython-fdb1dc77a45a26d8eac9f8b53f4d9200f54f7efe.tar.gz
Parse rejected deletes.
Diffstat (limited to 'git')
-rw-r--r--git/remote.py5
-rw-r--r--git/test/test_remote.py8
2 files changed, 12 insertions, 1 deletions
diff --git a/git/remote.py b/git/remote.py
index 4f32540f..8b1c588d 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -156,7 +156,10 @@ class PushInfo(object):
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
diff --git a/git/test/test_remote.py b/git/test/test_remote.py
index e87b60df..77e3ffbf 100644
--- a/git/test/test_remote.py
+++ b/git/test/test_remote.py
@@ -385,6 +385,14 @@ class TestRemote(TestBase):
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)