Skip to content

Commit

Permalink
Remove hook install_key (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
j178 authored Dec 19, 2024
1 parent 921f864 commit 635a19c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/cli/run/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ pub async fn install_hooks(hooks: &[Hook], reporter: &HookInstallReporter) -> Re
let to_install = hooks
.iter()
.filter(|hook| !hook.installed())
.unique_by(|hook| hook.install_key())
.filter_map(|hook| hook.environment_dir().map(|env_dir| (hook, env_dir)));
.filter_map(|hook| hook.environment_dir().map(|env_dir| (hook, env_dir)))
.unique_by(|(_, env_dir)| env_dir.clone());

let mut tasks = futures::stream::iter(to_install)
.map(|(hook, env_dir)| async move {
Expand Down
10 changes: 0 additions & 10 deletions src/hook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,16 +530,6 @@ impl Hook {
)
}

pub fn install_key(&self) -> String {
format!(
"{}-{}-{}-{}",
self.repo,
self.language,
self.language_version,
self.additional_dependencies.join(",")
)
}

// TODO: health check
/// Check if the hook is installed in the environment.
pub fn installed(&self) -> bool {
Expand Down
1 change: 1 addition & 0 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ impl Store {
);
clone_repo(repo_config.repo.as_str(), &repo_config.rev, temp.path()).await?;
} else {
// FIXME: Do not copy env dir.
// TODO: use hardlink?
// Optimization: This is an optimization from the Python pre-commit implementation.
// Copy already cloned base remote repo.
Expand Down

0 comments on commit 635a19c

Please sign in to comment.