[parser] [cmd_fsck] Test specification now done by parser
This commit is contained in:
parent
20cb57ecef
commit
c8f81c2ecd
2 changed files with 40 additions and 18 deletions
30
src/cmd_fsck
30
src/cmd_fsck
|
@ -18,23 +18,19 @@ cmd_fsck() {
|
||||||
[[ ! -f "${DB_FILE}" ]] && return 3
|
[[ ! -f "${DB_FILE}" ]] && return 3
|
||||||
[[ ! -d "${GIT_DIR}/.git" ]] && return 2
|
[[ ! -d "${GIT_DIR}/.git" ]] && return 2
|
||||||
|
|
||||||
if [[ -z "${cmdList[@]}" ]]; then
|
for cmd in ${cmdList[@]}; do
|
||||||
chk_deployed_ids "${TARGET}" "${DB_FILE}"
|
case ${cmd} in
|
||||||
chk_nonexistent_ids "${TARGET}" "${DB_FILE}"
|
deployed-ids)
|
||||||
chk_metadata "${GIT_DIR}" "${TARGET}" "${DB_FILE}"
|
chk_deployed_ids "${TARGET}" "${DB_FILE}"
|
||||||
fi
|
;;
|
||||||
|
|
||||||
case ${cmdList[@]} in
|
nonexistent-ids)
|
||||||
--deployed-ids)
|
chk_nonexistent_ids "${TARGET}" "${DB_FILE}"
|
||||||
chk_deployed_ids "${TARGET}" "${DB_FILE}"
|
;;
|
||||||
;;
|
|
||||||
|
|
||||||
--nonexistent-ids)
|
metadata)
|
||||||
chk_nonexistent_ids "${TARGET}" "${DB_FILE}"
|
chk_metadata "${GIT_DIR}" "${TARGET}" "${DB_FILE}"
|
||||||
;;
|
;;
|
||||||
|
esac
|
||||||
--metadata)
|
done
|
||||||
chk_metadata "${GIT_DIR}" "${TARGET}" "${DB_FILE}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
}
|
}
|
||||||
|
|
28
src/parser
28
src/parser
|
@ -88,7 +88,33 @@ case "${1}" in
|
||||||
|
|
||||||
fsck)
|
fsck)
|
||||||
shift
|
shift
|
||||||
cmd_fsck "${GIT_DIR}" "${@}"
|
while true; do
|
||||||
|
case ${1} in
|
||||||
|
--nonexistent-ids)
|
||||||
|
cmdList=(${cmdList[@]} nonexistent-ids)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
--deployed-ids)
|
||||||
|
cmdList=(${cmdList[@]} deployed-ids)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
--metadata)
|
||||||
|
cmdList=(${cmdList[@]} metadata)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
break 2
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ -z ${cmdList[@]} ]] && cmdList=(deployed-ids nonexistent-ids metadata)
|
||||||
|
|
||||||
|
cmd_fsck "${GIT_DIR}" "${@}" ${cmdList[@]}
|
||||||
EXIT=$?
|
EXIT=$?
|
||||||
[[ ${EXIT} -eq 3 ]] && echo "Database file non-existent"
|
[[ ${EXIT} -eq 3 ]] && echo "Database file non-existent"
|
||||||
[[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository"
|
[[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository"
|
||||||
|
|
Loading…
Reference in a new issue