hooks: bypass more hooks for push-redirected pushes

Summary:
Until we have the same standards for the native and push-redirected pushes,
these need to be automatically bypassed.

Reviewed By: krallin

Differential Revision: D24357372

fbshipit-source-id: f85459145f6a5217c07445d7017f3b11ed1284a7
This commit is contained in:
Kostia Balytskyi 2020-10-16 04:24:10 -07:00 committed by Facebook GitHub Bot
parent 1e9fd313ad
commit 7af104b330
3 changed files with 18 additions and 3 deletions

View File

@ -80,8 +80,13 @@ impl ChangesetHook for LimitCommitsize {
_bookmark: &BookmarkName,
changeset: &'cs BonsaiChangeset,
_content_fetcher: &'fetcher dyn FileContentFetcher,
_cross_repo_push_source: CrossRepoPushSource,
cross_repo_push_source: CrossRepoPushSource,
) -> Result<HookExecution> {
if cross_repo_push_source == CrossRepoPushSource::PushRedirected {
// For push-redirected commits, we rely on running source-repo hooks
return Ok(HookExecution::Accepted);
}
let mut totalsize = 0;
for (path, file_change) in changeset.file_changes() {
let file = match file_change {

View File

@ -77,8 +77,13 @@ impl FileHook for LimitFilesize {
content_fetcher: &'fetcher dyn FileContentFetcher,
change: Option<&'change FileChange>,
path: &'path MPath,
_cross_repo_push_source: CrossRepoPushSource,
cross_repo_push_source: CrossRepoPushSource,
) -> Result<HookExecution> {
if cross_repo_push_source == CrossRepoPushSource::PushRedirected {
// For push-redirected commits, we rely on running source-repo hooks
return Ok(HookExecution::Accepted);
}
let path = format!("{}", path);
if self
.ignore_path_regexes

View File

@ -81,8 +81,13 @@ impl FileHook for NoQuestionableFilenames {
_content_fetcher: &'fetcher dyn FileContentFetcher,
change: Option<&'change FileChange>,
path: &'path MPath,
_cross_repo_push_source: CrossRepoPushSource,
cross_repo_push_source: CrossRepoPushSource,
) -> Result<HookExecution> {
if cross_repo_push_source == CrossRepoPushSource::PushRedirected {
// For push-redirected pushes we rely on the hook
// running in the original repo
return Ok(HookExecution::Accepted);
}
if change.is_none() {
return Ok(HookExecution::Accepted);
}