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

feat: Remove all unnecessary install modes #159

Merged
merged 23 commits into from
Apr 17, 2024

Conversation

gabyx
Copy link
Owner

@gabyx gabyx commented Apr 9, 2024

Fixes: #152.

Two modes::

  • The normal mode sets local core.hooksPath on git hooks install in a repository and will not do any automatic installation on clone/init.
  • The centralized mode sets this globally and will work by default for all clone/init repos.

More changes:

  • Run-wrappers can still be installed in local repos, init.templateDir is not used and controlled by Githooks anymore.

  • Run-wrapper will use by default githooks-runner and as fallback use git config githooks.runner. Package manager builds tag: package_manager_enabled will not set this.

  • The installer has an option --hooks-dir which specifies the directory to place the maintained hooks.

  • The installer has an option --hooks-dir-use-template-dir in non---centralized mode which looks for a set GIT_TEMPLATE_DIR or init.templateDir or the Git default directory. This option is not encouraged, and will install templates on each init/clone as before.

  • The installer warns if the chosen hooks dir during install is pointing to a template directory used by Git.

  • User wanting to install run-wrappers instead of setting core.hooksPath should either use git hooks install --maintained-hooks or place a file <template-dir>/hooks/githooks-contains-run-wrappers to let Githooks know that this repo maintains run-wrappers (for updates etc, that no core.hooksPath is used but run-wrappers installed directly).

  • Registering is now done for all repositories (also in centralized mode).

  • git hook uninstall --full and git hooks uninstaller --full-uninstall-from-repos will clean all Git config and cached settings (checksums) in registered repositories, by default git hooks uninstall will not remove locally set githooks.* Git config variables, this is to make reinstallation more easy, e.g. githooks.maintainedHooks stays and will be read on reinstall.

@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch from 67a8ae1 to 9491434 Compare April 9, 2024 15:54
@gabyx gabyx marked this pull request as draft April 9, 2024 22:16
@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch from a3e84b0 to 2d12996 Compare April 9, 2024 22:16
@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch from 2d12996 to db23da5 Compare April 10, 2024 18:19
@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch from 3a21e8e to 9b672c9 Compare April 16, 2024 18:09
@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch from ac720a8 to 6118ae0 Compare April 16, 2024 20:12
@coveralls
Copy link

coveralls commented Apr 16, 2024

Coverage Status

coverage: 77.882% (-2.3%) from 80.215%
when pulling f24599f on feature/remove-all-unnecessary-install-modes
into 116356a on main.

- Update go to 1.21
- Add test to comply with all hooks in Git
- Add warning if hooks are existin on InstallRunWrapperLink
- Remove all EXTRA_INSTALL_ARGS modification in dockerfile, but instead
  use explicit parameter to `exec-steps.sh`
@gabyx gabyx self-assigned this Apr 17, 2024
@gabyx gabyx marked this pull request as ready for review April 17, 2024 17:20
@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch 5 times, most recently from cb4a237 to 319785d Compare April 17, 2024 21:11
- Disable 064 because it stucks in the windows build
@gabyx gabyx force-pushed the feature/remove-all-unnecessary-install-modes branch from 319785d to f24599f Compare April 17, 2024 21:30
@gabyx gabyx changed the base branch from main to feature/v3 April 17, 2024 21:53
@gabyx gabyx merged commit d0b7490 into feature/v3 Apr 17, 2024
12 checks passed
@gabyx gabyx deleted the feature/remove-all-unnecessary-install-modes branch April 17, 2024 21:56
gabyx added a commit that referenced this pull request Apr 21, 2024
**Two modes:**:

- The normal mode  sets **local** `core.hooksPath` on `git hooks install` in a repository and will not do any automatic installation on clone/init.
- The centralized mode sets this globally and will work by default for all clone/init repos.

**More changes**:

- Run-wrappers can still be installed in local repos, **`init.templateDir` is not used and controlled by Githooks anymore**.
- Run-wrapper will use by default `githooks-runner` and as fallback use `git config githooks.runner`. Package manager builds `tag: package_manager_enabled` will not set this.
- The installer has an option `--hooks-dir` which specifies the directory to place the maintained hooks.
- The installer has an option `--hooks-dir-use-template-dir` in non-`--centralized` mode which looks for a set `GIT_TEMPLATE_DIR` or `init.templateDir` or the Git default directory. This option is not encouraged, and will install templates on each init/clone as before. 
- The installer warns if  the chosen hooks dir during install is pointing to a template directory used by Git.

- User wanting to install run-wrappers instead of setting `core.hooksPath` should either use `git hooks install --maintained-hooks` or place a file `<template-dir>/hooks/githooks-contains-run-wrappers` to let Githooks know that this repo maintains run-wrappers (for updates etc, that no `core.hooksPath` is used but run-wrappers installed directly).
- Registering is now done for all repositories (also in centralized mode).
- `git hook uninstall --full` and `git hooks uninstaller --full-uninstall-from-repos` will clean all Git config and cached settings (checksums) in registered repositories, by default `git hooks uninstall` will not remove locally set `githooks.*` Git config variables, this is to make `reinstallation` more easy, e.g. `githooks.maintainedHooks` stays and will be read on reinstall.

**CI**:
- Go 1.22
- Remove `EXTRA_INSTALL_ARGS` sed modifications and pass explicitly.
- Disabled hanging test 064 (build from source) on windows.
- Coverage also runs `--centralized` tests too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Remove --templateDir install mode and only use core.hooksPath
2 participants