Pre-commit fails on Tower
The pre-commit script that auto-generates sketch previews fails on Tower (maybe it also happens on other GUI git clients).
From my understanding, hook scripts run in a different environment when initiated from one of these GUI git clients. This doesn't allow the scripts to access the proper PATH and other variables.
Related links:
- https://www.git-tower.com/help/mac/faq-and-tips/faq/hook-scripts
- http://stackoverflow.com/questions/17515769/why-is-my-ruby-git-script-hook-run-with-the-wrong-path
The full git error message:
pre-commit (auto-generate sketch previews): Installing sketchtool
running: /Applications/Sketch.app/Contents/Resources/sketchtool/install.sh
Installed sketchmigrate Version 1.0 (134) in /usr/local/bin
Installed sketchtool Version 40.1 (33804) in /usr/local/bin
pre-commit (auto-generate sketch previews): Looking for changed or added .sketch files
capturing: git diff --name-only --cached --pretty=format:
progress/pedro/slack-commands/slack-commands.sketch
pre-commit (auto-generate sketch previews): deleting old previews
pre-commit (auto-generate sketch previews): exporting pages
running: sketchtool --overwriting=YES --output=progress/pedro/slack-commands/slack-commands-sketch-previews export pages progress/pedro/slack-commands/slack-commands.sketch
pre-commit (auto-generate sketch previews): command failed: sketchtool --overwriting=YES --output=progress/pedro/slack-commands/slack-commands-sketch-previews export pages progress/pedro/slack-commands/slack-commands.sketch