Enable pipefail, nounset; Simplify some checks

This commit is contained in:
2024-10-08 21:18:04 +02:00
parent 8324384f88
commit 010c1f65ab
2 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,8 @@
#!/bin/sh
set -e
set -o errexit
set -o nounset
set -o pipefail
REPOSITORY=https://github.com/descartes-underwriting/devops-technical-test-data.git
BRANCH=main
@ -116,9 +118,7 @@ do
fi
# Retrieve file state (Added, Modified, Deleted)
# Using basic regex as we want to avoid checking '()' or other complex regex patterns.
# This is suboptimal and error prone. But it passes the full backup :-)
STATE=$(${GIT} ${GIT_OPTS[@]} show --name-status --pretty= ${COMMIT_SHA} | grep -G "^..${FILE}\$" | cut -f1)
STATE=$(${GIT} ${GIT_OPTS[@]} show --name-status --pretty= ${COMMIT_SHA} -- "${FILE}" | cut -f1)
if test "${STATE}" != "D"
then