Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
689 changes: 36 additions & 653 deletions src/hook_runner.rs

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ pub fn create_hook_directory(fs: &dyn FileSystem, hooks_dir: &Path) -> Result<()
/// Creates all standard Git hook files
///
/// This function creates a hook file for each standard Git hook. Each hook
/// file is a simple shell script that delegates to the `samoyed-hook` binary
/// runner. All hook files are made executable (mode 0755).
/// file is a simple shell script that delegates to the `samoyed hook` command.
/// All hook files are made executable (mode 0755).
///
/// # Arguments
///
Expand All @@ -168,13 +168,13 @@ pub fn create_hook_directory(fs: &dyn FileSystem, hooks_dir: &Path) -> Result<()
/// Each hook file contains:
/// ```bash
/// #!/usr/bin/env sh
/// exec samoyed-hook "$(basename "$0")" "$@"
/// exec samoyed hook "$(basename "$0")" "$@"
/// ```
///
/// This delegates to the `samoyed-hook` binary, passing the hook name and all arguments.
/// This delegates to the `samoyed hook` command, passing the hook name and all arguments.
pub fn create_hook_files(fs: &dyn FileSystem, hooks_dir: &Path) -> Result<(), HookError> {
let hook_content = r#"#!/usr/bin/env sh
exec samoyed-hook "$(basename "$0")" "$@""#;
exec samoyed hook "$(basename "$0")" "$@""#;

// Normalize line endings to LF for cross-platform compatibility
let normalized_content = normalize_line_endings(hook_content);
Expand Down
2 changes: 2 additions & 0 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use crate::project::ProjectType;
/// * `runner` - Command runner for executing system commands
/// * `fs` - Filesystem abstraction for file operations
/// * `project_type_hint` - Optional project type hint (e.g., "rust", "node")
/// * `force` - Optional force regeneration parameter (e.g., "_" to force hook regeneration)
///
/// # Returns
///
Expand All @@ -43,6 +44,7 @@ pub fn init_command(
runner: &dyn CommandRunner,
fs: &dyn FileSystem,
project_type_hint: Option<String>,
_force: Option<String>,
) -> Result<()> {
// Check if we're in a Git repository
if !fs.exists(Path::new(".git")) {
Expand Down
Loading
Loading