fix copying logic

This commit is contained in:
yequari 2023-09-24 12:30:43 -07:00
parent b306b0cc96
commit 650a8b373e
1 changed files with 8 additions and 4 deletions

View File

@ -42,7 +42,7 @@ checkout_branch() {
} }
copy_to_dest () { copy_to_dest () {
cp -r "${SRCDIR/*}" "${OUTDIR}" cp -r "${SRCDIR}/." "${OUTDIR}"
} }
update_publish() { update_publish() {
@ -57,14 +57,18 @@ update_publish() {
if [[ "$PUBONLY" == false ]]; then if [[ "$PUBONLY" == false ]]; then
get_changes get_changes
fi fi
diff "${SRCDIR} ${OUTDIR}" if diff "${SRCDIR}" "${OUTDIR}" >/dev/null; then
local rc=$? echo "No changes detected."
if [[ $rc -eq 1 ]]; then else
copy_to_dest copy_to_dest
fi fi
} }
main() { main() {
srcdirlen=${#SRCDIR}
if [[ ${SRCDIR:(-1)} == '/' ]]; then
SRCDIR=${SRCDIR:0:-1}
fi
if [[ -f "$FILE" ]]; then if [[ -f "$FILE" ]]; then
while read -r src out rem; do while read -r src out rem; do
# use rem as dummy variable to guarantee out countains one word # use rem as dummy variable to guarantee out countains one word