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.
This commit is contained in:
Tim Schumacher 2022-09-17 00:21:13 +02:00 committed by Ali Mohammad Pur
parent c1dc8c9ccb
commit 46b8a4cda3
Notes: sideshowbarker 2024-07-17 06:52:31 +09:00

View File

@ -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
}