mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Treat commit hook execution in observed repositories as a no-op, not an error
Summary: See PHI24. If you create a hosted Mercurial repository and switch it to observed, you can end up with a hook installed that runs on pulls and complains. Instead, just bail out if we're running on a pull. The corresponding Git hook doesn't run on pulls, so there's no issue in Git. Test Plan: Executed the hook in an observed Mercurial repository, got a clean exit. Reviewers: chad Reviewed By: chad Differential Revision: https://secure.phabricator.com/D18307
This commit is contained in:
parent
3f158aa71b
commit
03423c632c
1 changed files with 7 additions and 2 deletions
|
@ -48,8 +48,13 @@ if (!$repository) {
|
|||
}
|
||||
|
||||
if (!$repository->isHosted()) {
|
||||
// This should be redundant, but double check just in case.
|
||||
throw new Exception(pht('Repository "%s" is not hosted!', $argv[1]));
|
||||
// In Mercurial, the "pretxnchangegroup" hook fires for both pulls and
|
||||
// pushes. Normally we only install the hook for hosted repositories, but
|
||||
// if a hosted repository is later converted into an observed repository we
|
||||
// can end up with an observed repository that has the hook installed.
|
||||
// If we're running hooks from an observed repository, just exit without
|
||||
// taking action. For more discussion, see PHI24.
|
||||
return 0;
|
||||
}
|
||||
|
||||
$engine->setRepository($repository);
|
||||
|
|
Loading…
Reference in a new issue