Skip to content

fix(install): prompt to create missing .git/hooks folder#80

Merged
albertodebortoli merged 1 commit intomainfrom
fix/missing-hooks-folder
May 9, 2026
Merged

fix(install): prompt to create missing .git/hooks folder#80
albertodebortoli merged 1 commit intomainfrom
fix/missing-hooks-folder

Conversation

@albertodebortoli
Copy link
Copy Markdown
Member

Pull Request Title

fix(install): prompt to create missing .git/hooks folder

Description

  • When luca install --install-post-checkout-git-hook ran in a repo where .git/hooks didn't exist, FileManager.copyItem would fail with a cryptic low-level error ("The file post-checkout doesn't exist").
  • GitHookInstaller now detects the missing directory and asks the user via a Noora yesOrNoChoicePrompt ("Create missing hooks folder: Yes/No") whether Luca should create it. If the user declines, installation is skipped cleanly.

Type of Change

  • Feature
  • Bug fix
  • Maintenance / Refactor
  • Documentation
  • CI / Tooling
  • Other (specify)

How Has This Been Tested?

  • Added / updated unit tests
  • Manually tested locally (describe)
  • Tested on macOS (arch: arm64)
  • Other

Two new tests added to GitHookInstallerTests:

  • test_installPostCheckoutHook_whenHooksDirMissing_userConfirms_createsDirectoryAndInstalls
  • test_installPostCheckoutHook_whenHooksDirMissing_userDeclines_skipsInstallation

NoorableMock.yesOrNoChoicePrompt is now configurable via yesOrNoAnswer: Bool instead of fatalError.

Checklist

  • Swift code builds locally (swift build)
  • Tests pass locally (swift test)
  • Code style / formatting respected
  • Documentation updated (README / comments)
  • Version / tag alignment considered (if release related)
  • PR title follows conventional style (optional)

Breaking Changes?

  • No

Additional Notes

GitHookInstallerFileManaging gains a createDirectory(at:withIntermediateDirectories:) requirement; FileManagerWrapper and FileManagerWrapperMock already implement it so no additional changes are needed there.

…ailing silently

When the hooks directory is absent, GitHookInstaller now asks the user
via a Noora yesOrNoChoicePrompt whether Luca should create it, giving a
clear actionable message instead of a cryptic copy failure.
@albertodebortoli albertodebortoli added this to the 0.19.0 milestone May 9, 2026
@albertodebortoli albertodebortoli added the bugfix Something isn't working label May 9, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@albertodebortoli albertodebortoli merged commit f0c0434 into main May 9, 2026
3 checks passed
@albertodebortoli albertodebortoli deleted the fix/missing-hooks-folder branch May 9, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant