Created
September 9, 2017 19:45
-
-
Save alexjpaz/ba70c686fa361b1e9b00a2bd76c7b6f7 to your computer and use it in GitHub Desktop.
git pre-receive hook to run a command with the newest ref on the master branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master$ ]]; | |
then | |
echo $oldrev $newrev $ref | |
echo $PWD | |
set -x | |
set -e | |
mkdir /tmp/$newrev | |
git archive $newrev | tar -x -C /tmp/$newrev | |
find /tmp/$newrev | |
cat /tmp/$newrev/foo | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment