-
Notifications
You must be signed in to change notification settings - Fork 2
/
git-ready-to-deploy.m4
executable file
·45 lines (37 loc) · 1.05 KB
/
git-ready-to-deploy.m4
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
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
# This file was generated from an m4 template.
syscmd(`date -u --iso-8601=minutes |
sed "s/^/# Generation date-time (ISO 8601): /"')dnl
syscmd(`git remote get-url origin |
tr ":" "/" |
sed "s/^git@/https:\\/\\//" |
sed "s/\\.git$//" |
sed "s/^/# Git repository URL: /"')dnl
format(`# Commit ID: %s', include(HEAD_PATH))dnl
syscmd(`perl -pe "chomp if eof" LICENSE |
sed "s/^/# /"')
set -euo pipefail
failcode=1
nlines=$(git status . --porcelain | wc -l)
if [ ${nlines} -ne 0 ] ; then
cat <<EOF
#####################################################
# Nice! You have changes. Now commit or stash them. #
#####################################################
EOF
git status .
exit ${failcode}
fi
echo "Let me check your remote.."
git remote update
nlines=$(git cherry | (grep "^+" || true) | wc -l)
if [ ${nlines} -ne 0 ] ; then
cat <<EOF
#####################################
# Nice! You have commits. Now push. #
#####################################
EOF
git status .
exit ${failcode}
fi
echo "Looks like you are up-to-date."