|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# This file was generated from an m4 template. |
| 4 | +# Generation date-time (ISO 8601): 2018-06-22T10:10+00:00 |
| 5 | +# Git repository URL: https://github.com/oleks/git-ready-to-deploy |
| 6 | +# Commit ID: 394c2b040558a890d33d996c402d6594d1e5dfc6 |
| 7 | + |
| 8 | +# Copyright (c) 2016-2018 Oleks <oleks@oleks.info> |
| 9 | +# |
| 10 | +# Permission is hereby granted, free of charge, to any person obtaining |
| 11 | +# a copy of this software and associated documentation files (the |
| 12 | +# "Software"), to deal in the Software without restriction, including |
| 13 | +# without limitation the rights to use, copy, modify, merge, publish, |
| 14 | +# distribute, sublicense, and/or sell copies of the Software, and to |
| 15 | +# permit persons to whom the Software is furnished to do so, subject to |
| 16 | +# the following conditions: |
| 17 | +# |
| 18 | +# The above copyright notice and this permission notice shall be |
| 19 | +# included in all copies or substantial portions of the Software. |
| 20 | +# |
| 21 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 22 | +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 23 | +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 24 | +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 25 | +# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 26 | +# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 27 | +# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 28 | + |
| 29 | +set -euo pipefail |
| 30 | + |
| 31 | +failcode=1 |
| 32 | + |
| 33 | +nlines=$(git status . --porcelain | wc -l) |
| 34 | +if [ ${nlines} -ne 0 ] ; then |
| 35 | + cat <<EOF |
| 36 | +##################################################### |
| 37 | +# Nice! You have changes. Now commit or stash them. # |
| 38 | +##################################################### |
| 39 | +EOF |
| 40 | + git status . |
| 41 | + exit ${failcode} |
| 42 | +fi |
| 43 | + |
| 44 | +echo "Let me check your remote.." |
| 45 | +git remote update |
| 46 | + |
| 47 | +nlines=$(git cherry | (grep "^+" || true) | wc -l) |
| 48 | +if [ ${nlines} -ne 0 ] ; then |
| 49 | + cat <<EOF |
| 50 | +##################################### |
| 51 | +# Nice! You have commits. Now push. # |
| 52 | +##################################### |
| 53 | +EOF |
| 54 | + git status . |
| 55 | + exit ${failcode} |
| 56 | +fi |
| 57 | + |
| 58 | +echo "Looks like you are up-to-date." |
0 commit comments