From 46b8a4cda3fc6680ef444d53a77577d5dd8a4689 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Sat, 17 Sep 2022 00:21:13 +0200 Subject: [PATCH] Ports: Only regenerate patches if there are actual changed commits We were previously comparing the hash against the hash after the initial import, which caused us to regenerate patches every time as long as we did have patches (even if they haven't changed at all) and the script entirely missing that it should remove patches if the current commit is the "import" commit. --- Ports/.port_include.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index 7b21a89fd6..0494a0458e 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -813,19 +813,18 @@ do_dev() { exit 1 } - local first_hash="$(git -C "$workdir" rev-list --max-parents=0 HEAD)" - pushd "$workdir" launch_user_shell popd >/dev/null 2>&1 + local original_hash="$(git -C "$workdir" rev-parse refs/tags/original)" local current_hash="$(git -C "$workdir" rev-parse HEAD)" - # If the hashes are the same, we have no patches, otherwise generate patches - if [ "$first_hash" != "$current_hash" ]; then - >&2 echo "Note: Regenerating patches as there are some commits in the port repo (started at $first_hash, now is $current_hash)" + # If the hashes are the same, we have no changes, otherwise generate patches + if [ "$original_hash" != "$current_hash" ]; then + >&2 echo "Note: Regenerating patches as there are changed commits in the port repo (started at $original_hash, now is $current_hash)" rm -fr "${PORT_META_DIR}"/patches/*.patch - git -C "$workdir" format-patch --no-numbered --zero-commit --no-signature --full-index "$first_hash" -o "$(realpath "${PORT_META_DIR}/patches")" + git -C "$workdir" format-patch --no-numbered --zero-commit --no-signature --full-index refs/tags/import -o "$(realpath "${PORT_META_DIR}/patches")" do_generate_patch_readme fi }