Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hook install_key #153

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading