Skip to content

Commit

Permalink
fix: 🐛 (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasAugustin committed Jan 8, 2024
1 parent ead0d0e commit 8697c17
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/sync_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,22 @@ if [ -s "${TEMPLATE_SYNC_IGNORE_FILE_PATH}" ]; then
echo "::endgroup::"
fi

echo "::group::commit changes"

force_delete_files() {

function force_delete_files() {
echo "::group::force file deletion"
warn "force file deletion is enabled. Deleting files which are deleted within the target repository"
git log --diff-filter D --pretty="format:" --name-only "${TEMPLATE_REMOTE_GIT_HASH}"..HEAD | sed '/^$/d' | xargs rm
FILES_TO_DELETE=$(git log --diff-filter D --pretty="format:" --name-only "${TEMPLATE_REMOTE_GIT_HASH}"..HEAD | sed '/^$/d')
warn "files to delete: ${FILES_TO_DELETE}"
echo "${FILES_TO_DELETE}" | xargs rm
echo "::endgroup::"
}

if [ "$IS_FORCE_DELETION" == "true" ]; then
force_delete_files
fi

echo "::group::commit changes"
git add .

# we are checking the ignore file if it exists or is empty
Expand Down

0 comments on commit 8697c17

Please sign in to comment.