Sync on master push
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
|
||||
if ! "$repo_root/scripts/devcpone_sync.sh"; then
|
||||
printf '%s\n' "devcpone sync skipped/failed; commit kept intact" >&2
|
||||
fi
|
||||
exit 0
|
||||
|
||||
35
.githooks/pre-push
Executable file
35
.githooks/pre-push
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
remote_name=$1
|
||||
remote_url=$2
|
||||
|
||||
case "$remote_url" in
|
||||
*devcpone.aplikasi.web.id*|*10.9.10.205*)
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/devcpone-prepush.XXXXXX")
|
||||
trap 'rm -rf "$tmpdir"' EXIT HUP INT TERM
|
||||
|
||||
touch "$tmpdir/pushes"
|
||||
cat > "$tmpdir/pushes"
|
||||
|
||||
while read -r local_ref local_sha remote_ref remote_sha; do
|
||||
case "$local_ref:$remote_ref" in
|
||||
refs/heads/master:refs/heads/master)
|
||||
branch=master
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
|
||||
repo_root=$(git rev-parse --show-toplevel)
|
||||
if ! "$repo_root/scripts/devcpone_sync.sh" "$branch"; then
|
||||
printf '%s\n' "devcpone sync skipped/failed; push kept intact" >&2
|
||||
fi
|
||||
done < "$tmpdir/pushes"
|
||||
Reference in New Issue
Block a user