Skip to content

Commit

Permalink
Delete legacy limit_path_length hook
Browse files Browse the repository at this point in the history
Summary:
Step #3 mentioned in D54118734.

Since D55240167 has been pushed, we can now remove the legacy config code.

Reviewed By: andreacampi

Differential Revision: D55313181

fbshipit-source-id: ca7e0b33c054c5cfa838c6ba924333d45ba21683
  • Loading branch information
gustavoavena authored and facebook-github-bot committed Apr 3, 2024
1 parent 542c233 commit a370c98
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 156 deletions.
10 changes: 1 addition & 9 deletions eden/mononoke/hooks/src/implementations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,7 @@ pub fn make_file_hook(
.build()?,
)),
"limit_path_length" => {
let hook = if let Some(_json_options) = &params.config.options {
limit_path_length::LimitPathLengthHook::new(&params.config)?
} else {
// TODO(T163510936): delete legacy LimitPathLengthConfig code
let legacy_hook_config =
limit_path_length::LimitPathLengthConfig::from_legacy_config(&params.config)?;

limit_path_length::LimitPathLengthHook::with_config(legacy_hook_config)?
};
let hook = limit_path_length::LimitPathLengthHook::new(&params.config)?;
Some(Box::new(hook))
}
"no_bad_filenames" => Some(Box::new(no_bad_filenames::NoBadFilenamesHook::new(
Expand Down
15 changes: 0 additions & 15 deletions eden/mononoke/hooks/src/implementations/limit_path_length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

use anyhow::anyhow;
use anyhow::Context;
use anyhow::Error;
use anyhow::Result;
use async_trait::async_trait;
Expand All @@ -32,20 +31,6 @@ pub struct LimitPathLengthConfig {
length_limit: usize,
}

impl LimitPathLengthConfig {
// TODO(T163510936): delete legacy LimitPathLengthConfig code
pub fn from_legacy_config(config: &HookConfig) -> Result<Self, Error> {
let length_limit = config
.strings
.get("length_limit")
.ok_or_else(|| Error::msg("Required config length_limit is missing"))?;

let length_limit = length_limit.parse().context("While parsing length_limit")?;

Ok(Self { length_limit })
}
}

/// Hook to block commits changing file paths above a certain length.
/// This is needed because Mercurial has these limits and we shouldn't allow
/// commits that can't be synced to mercurial.
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit a370c98

Please sign in to comment.