mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Accept pushes with arbitrary Git refs
Summary: Depends on D20419. Ref T13277. Fixes T8936. Fixes T9383. Fixes T12300. When you push arbitrary refs to Phabricator, the push log currently complains if those refs are not tags or branches. Upstream Git now features "notes", and there's no reason to prevent writes to arbitrary refs, particularly beause we plan to start using them soon (see T13278). Allow these writes as affecting raw refs. Test Plan: - Pushed an arbitrary ref. - Pushed some Git notes. - Wrote a Herald ref rule, saw "ref" in the dropdown. {F6376492} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13277, T8936, T9383, T12300 Differential Revision: https://secure.phabricator.com/D20420
This commit is contained in:
parent
870b01f2d0
commit
23b86bae6c
4 changed files with 7 additions and 4 deletions
|
@ -459,10 +459,7 @@ final class DiffusionCommitHookEngine extends Phobject {
|
|||
$ref_type = PhabricatorRepositoryPushLog::REFTYPE_TAG;
|
||||
$ref_raw = substr($ref_raw, strlen('refs/tags/'));
|
||||
} else {
|
||||
throw new Exception(
|
||||
pht(
|
||||
"Unable to identify the reftype of '%s'. Rejecting push.",
|
||||
$ref_raw));
|
||||
$ref_type = PhabricatorRepositoryPushLog::REFTYPE_REF;
|
||||
}
|
||||
|
||||
$ref_update = $this->newPushLog()
|
||||
|
|
|
@ -24,6 +24,7 @@ final class DiffusionPreCommitRefTypeHeraldField
|
|||
$types = array(
|
||||
PhabricatorRepositoryPushLog::REFTYPE_BRANCH => pht('branch (git/hg)'),
|
||||
PhabricatorRepositoryPushLog::REFTYPE_TAG => pht('tag (git)'),
|
||||
PhabricatorRepositoryPushLog::REFTYPE_REF => pht('ref (git)'),
|
||||
PhabricatorRepositoryPushLog::REFTYPE_BOOKMARK => pht('bookmark (hg)'),
|
||||
);
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ final class PhabricatorRepositoryPushLog
|
|||
const REFTYPE_TAG = 'tag';
|
||||
const REFTYPE_BOOKMARK = 'bookmark';
|
||||
const REFTYPE_COMMIT = 'commit';
|
||||
const REFTYPE_REF = 'ref';
|
||||
|
||||
const CHANGEFLAG_ADD = 1;
|
||||
const CHANGEFLAG_DELETE = 2;
|
||||
|
|
|
@ -149,6 +149,10 @@ final class PhabricatorRepositoryPushMailWorker
|
|||
$type_name = pht('bookmark');
|
||||
$type_prefix = pht('bookmark:');
|
||||
break;
|
||||
case PhabricatorRepositoryPushLog::REFTYPE_REF:
|
||||
$type_name = pht('ref');
|
||||
$type_prefix = pht('ref:');
|
||||
break;
|
||||
case PhabricatorRepositoryPushLog::REFTYPE_COMMIT:
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue