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