Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unlink symlinks before copying git hooks
there was an issue where if a git hook with the same name existed already, but was a symlink, ka-clone would overrwrite the link destination’s contents rather than replacing the symlink! apparently this is what python’s `shutil.copyfile` does by design. as a fix, manually unlink any symlinks first to be extra safe, then use `shutil.copy` instead. #devenvfixup Auditors: csilvers, ethan, mopewa
- Loading branch information
b5d21b0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In certain cases for users upgrading from older versions of khan-dotfiles where the git template had a symlink directly into
khan-linter
, there was an edge case where this could lead to ka-clone overwriting the contents of khan-linter'sgithook.py
, which then strangely causes the confusing_ka-commit-lint: fork: Resource temporarily unavailable
error experienced by a few devs.For people who find themselves in this situation, the absolute easiest fix is to entirely delete the
devtools/khan-linter
anddevtools/ka-clone
directories and then rerunsetup.sh
in khan-dotfiles, which will obtain fresh copies and then automatically repair the repositories. (If affecting a repository not handled by dotfiles, after the above steps are taken one can runka-clone --repair
manually in the effected repository)Gotta love it when one line of code can cause a cascading issue across three different repositories!