From 16b936dbc739de17e31322a32b1e6d55ffe01218 Mon Sep 17 00:00:00 2001 From: Mitesh Shah Date: Fri, 2 Aug 2013 19:49:56 +0530 Subject: [PATCH] Only Initialise Git If .git not exist --- usr/local/sbin/easyengine | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/usr/local/sbin/easyengine b/usr/local/sbin/easyengine index 24bd93ba..1767bd26 100755 --- a/usr/local/sbin/easyengine +++ b/usr/local/sbin/easyengine @@ -304,12 +304,25 @@ PURGEALL() # EE GIT Function EEGITINIT() { - # Initialise Git - echo -e "\033[34m Initialise Git On $EEGITDIR... \e[0m" + # Change Directory cd $EEGITDIR || OwnError "Unable To Change Directory $EEGITDIR" - git init || OwnError "Unable To Initialise Git On $EEGITDIR" - git add . && git commit -am "Initialise Git On $EEGITDIR" \ - || OwnError "Unable To Git Commit On $EEGITDIR" + + # Check .git + if [ ! -d .git ] + then + # Initialise Git + echo -e "\033[34m Initialise Git On $EEGITDIR... \e[0m" + git init || OwnError "Unable To Initialise Git On $EEGITDIR" + fi + + # Check For Untracked Files + git status | grep clean + if [ $? -ne 0 ] + then + # Add Files In Git Version Control + git add . && git commit -am "Initialise Git On $EEGITDIR" \ + || OwnError "Unable To Git Commit On $EEGITDIR" + fi } EEGITCOMMIT()