Skip to content

Commit

Permalink
fix support for tgz compression thanks to @DavidGregory084
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMajoinen committed Aug 3, 2023
1 parent 31906de commit bdfc4c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hooks/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi

build_key "${MAX_LEVEL}" "${RESTORE_PATH}" >/dev/null # to validate the level

ACTUAL_PATH=$(mktemp)
ACTUAL_PATH=$(mktemp -d)

if [ "${COMPRESS}" = 'tgz' ]; then
UNCOMPRESS_COMMAND=(tar xzf)
Expand All @@ -54,7 +54,7 @@ for CURRENT_LEVEL in "${SORTED_LEVELS[@]}"; do

if [ "${COMPRESS}" != 'none' ]; then
echo "Cache is compressed, uncompressing..."
"${UNCOMPRESS_COMMAND[@]}" "${ACTUAL_PATH}" "${RESTORE_PATH}"
"${UNCOMPRESS_COMMAND[@]}" "${ACTUAL_PATH}/archive.tgz" "${RESTORE_PATH}"
fi

exit 0
Expand Down
6 changes: 3 additions & 3 deletions hooks/post-command
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ fi

if [ "${COMPRESS}" != 'none' ]; then
echo "Compressing ${CACHE_PATH} with ${COMPRESS}..."
ACTUAL_PATH=$(mktemp)
"${COMPRESS_COMMAND[@]}" "${ACTUAL_PATH}" "${CACHE_PATH}"
ACTUAL_PATH=$(mktemp -d)
"${COMPRESS_COMMAND[@]}" "${ACTUAL_PATH}/archive.tgz" "${CACHE_PATH}"
else
ACTUAL_PATH="${CACHE_PATH}"
fi

echo "Saving ${LEVEL}-level cache of ${CACHE_PATH}"
backend_exec save "${KEY}" "${ACTUAL_PATH}"
backend_exec save "${KEY}" "${ACTUAL_PATH}"

0 comments on commit bdfc4c6

Please sign in to comment.