Defaulty show detected changes and add full diff (-F) & hide changes (-H) features
This commit is contained in:
parent
afdb389214
commit
20e5fc23ca
1 changed files with 18 additions and 1 deletions
|
@ -11,16 +11,20 @@ GIT_ROOT=/srv/common
|
|||
GIT_REMOTE=origin
|
||||
DEBUG=0
|
||||
CHECK_REMOTE=0
|
||||
HIDE_CHANGES=0
|
||||
FULL_DIFF=0
|
||||
|
||||
function usage() {
|
||||
echo "Usage : $0 -g [directory] [-c|-r remote] [-d]
|
||||
-g [directory] Specify Git root directory (default : $GIT_ROOT)
|
||||
-c Check Git remote state
|
||||
-r [remote] Specify Git remote to check (default : $GIT_REMOTE)
|
||||
-H Hide detected changes
|
||||
-F Show full diff in case of changes detected (default: short)
|
||||
-d Enable debug mode"
|
||||
}
|
||||
|
||||
while getopts "g:r:cdh-:" OPTION
|
||||
while getopts "g:r:cdFHh-:" OPTION
|
||||
do
|
||||
case "$OPTION" in
|
||||
c)
|
||||
|
@ -36,6 +40,12 @@ do
|
|||
d)
|
||||
DEBUG=1
|
||||
;;
|
||||
H)
|
||||
HIDE_CHANGES=1
|
||||
;;
|
||||
F)
|
||||
FULL_DIFF=1
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
|
@ -66,6 +76,13 @@ then
|
|||
elif [ -n "$STATUS" ]
|
||||
then
|
||||
echo "WARNING : Git config repo on $( hostname ) not clean"
|
||||
if [ $FULL_DIFF -eq 1 ]
|
||||
then
|
||||
git diff
|
||||
elif [ $HIDE_CHANGES -ne 1 ]
|
||||
then
|
||||
echo -e "$STATUS"
|
||||
fi
|
||||
exit 1
|
||||
elif [ $CHECK_REMOTE -eq 1 ]
|
||||
then
|
||||
|
|
Loading…
Reference in a new issue