HomePhabricator

Respond more gracefully when a git push deletes a nonexistent ref

Description

Respond more gracefully when a git push deletes a nonexistent ref

Summary:
Fixes T5534. If you git push origin :refs/tags/doesnotexist (for some non-existing tag), we get a change where both the old and new refs are empty.

We incorrectly call this an "add", because the old ref is empty. Instead, call this a "delete", but skip the logic which would normally mark it dangerous.

(Possibly we should just reject these outright, but Git allows them, so stick with that for now.)

Test Plan:
Pushed nonexistent refs:

$ git push origin :refs/tags/doesnotexist
remote: warning: Allowing deletion of corrupt ref.
To ssh://dweller@localhost/diffusion/POEMS/
 - [deleted]         doesnotexist
$

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5534

Differential Revision: https://secure.phabricator.com/D9800

Details

Provenance
epriestleyAuthored on
epriestleyPushed on Jul 10 2014, 5:17 PM
Reviewer
btrahan
Differential Revision
D9800: Respond more gracefully when a git push deletes a nonexistent ref
Parents
rP16648c28bcd7: Add GROUP BY to commit query
Branches
Unknown
Tags
Unknown
Tasks
T5534: Remove Git tags from origin causes crash

Event Timeline