diff --git a/src/cmd_deploy b/src/cmd_deploy index fecd830..7f6dd90 100644 --- a/src/cmd_deploy +++ b/src/cmd_deploy @@ -16,7 +16,7 @@ cmd_deploy() { local ERR=false local DB_FILE="${TARGET}/${_OPT_DB_FILE}" [[ ! -f "${DB_FILE}" ]] && return 1 - [[ ! -f "${GIT_DIR}/.git" ]] && return 2 + [[ ! -d "${GIT_DIR}/.git" ]] && return 2 if [[ -z "$(grep LAST_DEPLOY ${DB_FILE})" ]]; then echo -e "LAST_DEPLOY\t$(git -C "${GIT_DIR}" rev-list HEAD | tail -n 1)" >> ${DB_FILE} diff --git a/src/cmd_du b/src/cmd_du index b3787f1..b0d0fc5 100644 --- a/src/cmd_du +++ b/src/cmd_du @@ -15,7 +15,7 @@ cmd_du() { local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}" [[ ! -f "${DB_FILE}" ]] && return 1 - [[ ! -f "${GIT_DIR}/.git" ]] && return 2 + [[ ! -d "${GIT_DIR}/.git" ]] && return 2 local imageidList=($(awk 'BEGIN{FS="\t"}{if($1=="true"){print $2}}' ${DB_FILE} | awk '!seen[$0]++')) local DU="$(print_imageid_du ${GIT_DIR} ${imageidList[@]})" diff --git a/src/cmd_exclude b/src/cmd_exclude index 332c4a6..781c82a 100644 --- a/src/cmd_exclude +++ b/src/cmd_exclude @@ -21,7 +21,7 @@ cmd_exclude() { local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 local conditionList=("${@}") [[ ! -f "${DB_FILE}" ]] && return 1 - [[ ! -f "${GIT_DIR}/.git" ]] && return 2 + [[ ! -d "${GIT_DIR}/.git" ]] && return 2 for condition in ${conditionList[@]}; do _msg EXEC "Excluding all tracks that match the following condition: ${condition}" diff --git a/src/cmd_fsck b/src/cmd_fsck index cea1f18..b3a4f08 100644 --- a/src/cmd_fsck +++ b/src/cmd_fsck @@ -15,7 +15,7 @@ cmd_fsck() { local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}" [[ ! -f "${DB_FILE}" ]] && return 1 - [[ ! -f "${GIT_DIR}/.git" ]] && return 2 + [[ ! -d "${GIT_DIR}/.git" ]] && return 2 chk_deployed_ids "${TARGET}" "${DB_FILE}" chk_nonexistent_ids "${TARGET}" "${DB_FILE}" diff --git a/src/cmd_include b/src/cmd_include index 0614c19..a6d3287 100644 --- a/src/cmd_include +++ b/src/cmd_include @@ -21,7 +21,7 @@ cmd_include() { local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 local conditionList=("${@}") [[ ! -f "${DB_FILE}" ]] && return 1 - [[ ! -f "${GIT_DIR}/.git" ]] && return 2 + [[ ! -d "${GIT_DIR}/.git" ]] && return 2 for condition in ${conditionList[@]}; do _msg EXEC "Including all tracks that match the following condition: ${condition}" diff --git a/src/cmd_update b/src/cmd_update index bd392f9..8c5d828 100644 --- a/src/cmd_update +++ b/src/cmd_update @@ -15,7 +15,7 @@ cmd_update() { local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}" [[ ! -f "${DB_FILE}" ]] && return 1 - [[ ! -f "${GIT_DIR}/.git" ]] && return 2 + [[ ! -d "${GIT_DIR}/.git" ]] && return 2 # In the event that LAST_COMMIT OR DB_FILE does not exist, echo out that the LAST_COMMIT # is the first COMMIT of GIT_DIR, thus stating that no database update has ever occured diff --git a/src/parser b/src/parser index c68e4c1..3d30a6f 100644 --- a/src/parser +++ b/src/parser @@ -27,7 +27,6 @@ while true; do if [ -z "${1#*=}" ]; then help else - log ECHO "--git-dir called. Git directory now defined as: ${1#*=}" GIT_DIR="${1#*=}" fi @@ -46,41 +45,49 @@ case "${1}" in exclude) shift cmd_exclude "${GIT_DIR}" ${@} - [[ $? -eq 1 ]] && echo "Database file non-existent" - [[ $? -eq 2 ]] && echo "Git directory not a valid git repository" + EXIT=$? + [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; include) shift cmd_include$ "${GIT_DIR}" ${@} - [[ $? -eq 1 ]] && echo "Database file non-existent" - [[ $? -eq 2 ]] && echo "Git directory not a valid git repository" + EXIT=$? + [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; deploy) shift cmd_deploy "${GIT_DIR}" ${@} - [[ $? -eq 1 ]] && echo "Database file non-existent" - [[ $? -eq 2 ]] && echo "Git directory not a valid git repository" + EXIT=$? + [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; update) shift cmd_update "${GIT_DIR}" ${@} - [[ $? -eq 1 ]] && echo "Database file non-existent" - [[ $? -eq 2 ]] && echo "Git directory not a valid git repository" + EXIT=$? + [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; du) shift cmd_du "${GIT_DIR}" "${@}" - [[ $? -eq 1 ]] && echo "Database file non-existent" - [[ $? -eq 2 ]] && echo "Git directory not a valid git repository" + EXIT=$? + [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; fsck) shift cmd_fsck "${GIT_DIR}" "${@}" + EXIT=$? + [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; esac