forked from wine-compholio/wine-staging
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprecommit-hook.sh
More file actions
executable file
·32 lines (27 loc) · 807 Bytes
/
precommit-hook.sh
File metadata and controls
executable file
·32 lines (27 loc) · 807 Bytes
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
#!/bin/bash
# Installation: ln -s ../../precommit-hook.sh .git/hooks/pre-commit
warning()
{
echo ""
echo "*** $1 ***"
echo ""
}
if git status --porcelain "staging" | grep -q "^.[^ ]"; then
warning "PLEASE ADD OR STASH YOUR CHANGES IN staging"
exit 1
fi
if git status --porcelain "patches" | grep -v "^.\\?.*\\.py$" | grep -q "^.[^ ]"; then
warning "PLEASE ADD OR STASH YOUR CHANGES IN patches"
exit 1
fi
if ! git status --porcelain "staging/VERSION" | grep -q "^M."; then
perl -i -pe 's/(\d+)$/($1 + 1)." (unreleased)"/e' "staging/VERSION"
git add "staging/VERSION"
fi
git diff --cached --name-status | while read status file; do
if [[ "$file" =~ ^patches/ ]] || [[ "$file" =~ ^staging/ ]]; then
warning "UPDATING AUTOGENERATED FILES"
./staging/patchupdate.py || exit 1
break;
fi
done