thoughtbot / thoughtbot/dotfiles
Symlinking git hooks causing unexpected behaviour
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 8.2k
- Forks
- 1.8k
- Avg merge
- 10d 14h
- Merged PRs (30d)
- 1
Description
Thank you for a great repo guys, it helps me really a lot to organise all the dotfiles stuff!
There is a potential implicit issue/risk covers in symlinking hooks.
Description:
Let's say you have such scenario:
git clone project-agit clone project-bcd project-acomposer install// additionally installs f.e. post-commit hook
This will most probably break project-b by modifying the project hooks and additionally will modify template hooks in the root dotfiles folder.
In such a scenario composer changes post-commit hook in the project-a which following the links chain, leads to the changes in project-b/.git/hooks/post-commit as well as ~/dotfiles/git_template/hooks/post-commit, since post-commit in project-a is just a link to the initial file.
It's quite common that some tool like composer may change hooks, which leads to such implicit scenario if hooks were symlinked.
Possible solution:
git_template/hooks should be copied and not symlinked
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting git_template/hooks and the setup that links hooks into cloned repositories. Reproduce the project-a/project-b scenario with composer installing a post-commit hook, then verify that changing one repository's hook no longer changes the other repository or the template. Done means hooks are isolated while the documented setup still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, shell
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100