-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpre-push.template
36 lines (29 loc) · 1.39 KB
/
pre-push.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# This file needs to be copied into <repoRoot>/.git/hooks, and named "pre-push".
# Other examples and details of the pre-push hook can be found in the "pre-push.sample" file, in that folder.
#
# Essentially what this script does is look at each file that has been modified/added versus remote/master
# It then checks those files for any sign that they have been prettified, and not then re-uglified.
#
# This script will be run any time the user attempts to push.
# If it returns non-zero, the push will be prevented.
set -eu
IFS=$'\n'
for touchedFiles in $(git diff --name-only HEAD origin/master)
do
if [[ -f $touchedFiles ]]; then
if [[ $touchedFiles == *dataflow*.json ]]; then
echo Checking that $touchedFiles is suitably ugly.
(./dataflowGitDiffTool/AdfDataflowFilePrettifier.exe -verifyIsUgly -fromFile $touchedFiles)
verificationExitCode=$?
if [ "$verificationExitCode" -ne "0" ]; then
echo Found file that appears to have been prettified: $touchedFiles
echo All files should have been re-uglified before pushing... Ideally, before committing!
echo See ./dataflowGitDiffTool/AdfDataflowFilePrettifier for details of what is detected as a \'prettified\' file.
echo Blocking Push
exit 1
fi
fi
fi
done
exit 0