mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[FIX] forwardport: apparently git/refs/heads can fuzzy-match
If the ref we asked for does not exist, github apparently decides to fall-back to prefix-matching. So if we're trying to delete already-deleted branch A and someone called their branch A-x we're going to get it as a result. Thankfully they were apparently smart enough to return a list even if there's only a single fuzzy match. So if we get a list (instead of a dict) as response to git/refs/heads assume the branch was already deleted as if we got a 404.
This commit is contained in:
parent
1207daded1
commit
5f8041552b
@ -140,6 +140,12 @@ class DeleteBranches(models.Model, Queue):
|
||||
return
|
||||
|
||||
ref = ref.json()
|
||||
if isinstance(ref, list):
|
||||
_deleter.info(
|
||||
"✘ got a fuzzy match (%s), branch probably deleted",
|
||||
', '.join(r['ref'] for r in ref)
|
||||
)
|
||||
|
||||
if ref['object']['sha'] != self.pr_id.head:
|
||||
_deleter.info(
|
||||
"✘ branch %s head mismatch, expected %s, got %s",
|
||||
|
Loading…
Reference in New Issue
Block a user