diff --git a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php index 98bd78bc77..ae1423cc21 100644 --- a/src/applications/diffusion/engine/DiffusionCommitHookEngine.php +++ b/src/applications/diffusion/engine/DiffusionCommitHookEngine.php @@ -477,7 +477,12 @@ final class DiffusionCommitHookEngine extends Phobject { $ref_flags = 0; $dangerous = null; - if ($ref_old === self::EMPTY_HASH) { + if (($ref_old === self::EMPTY_HASH) && ($ref_new === self::EMPTY_HASH)) { + // This happens if you try to delete a tag or branch which does not + // exist by pushing directly to the ref. Git will warn about it but + // allow it. Just call it a delete, without flagging it as dangerous. + $ref_flags |= PhabricatorRepositoryPushLog::CHANGEFLAG_DELETE; + } else if ($ref_old === self::EMPTY_HASH) { $ref_flags |= PhabricatorRepositoryPushLog::CHANGEFLAG_ADD; } else if ($ref_new === self::EMPTY_HASH) { $ref_flags |= PhabricatorRepositoryPushLog::CHANGEFLAG_DELETE;