From 07136645acc4036c4575da3d585b90d0253a532a Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 14 Oct 2014 12:00:35 +0530 Subject: [PATCH] Fixed Git function in update script --- bin/update | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/bin/update b/bin/update index 7eb0c836..552bd02b 100644 --- a/bin/update +++ b/bin/update @@ -33,22 +33,24 @@ function ee_lib_error() function ee_lib_git() { for ee_git_dir in ${@:1:$(($#-1))}; do - # Change directory - cd $ee_git_dir || ee_lib_error "Unable to change directory $ee_git_dir, exit status = " $? - - # Check .git - if [ ! -d .git ]; then - # ee_lib_echo "Initialize Git on ${ee_git_dir}" - git init &>> $EE_UPDATE_LOG \ - || ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? - fi + if [ -d $ee_git_dir ]; then + # Change directory + cd $ee_git_dir + + # Check .git + if [ ! -d .git ]; then + # ee_lib_echo "Initialize Git on ${ee_git_dir}" + git init &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? + fi - # Check for untracked files - if [ $(git status -s | wc -l) -ne 0 ]; then - # Add files in Git version control - ee_lib_echo "Git commit on $ee_git_dir, please wait..." - git add --all && git commit -am "${@: -1}" &>> $EE_UPDATE_LOG \ - || ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? + # Check for untracked files + if [ $(git status -s | wc -l) -ne 0 ]; then + # Add files in Git version control + ee_lib_echo "Git commit on $ee_git_dir, please wait..." + git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? + fi fi done }