Fix legacy patch snapshot comparisons

Fixes #112
This commit is contained in:
Oğuz Sivrikaya
2026-12-02 00:15:34 +03:00
parent f7f03601dc
commit 690bd64394
2 changed files with 7 additions and 3 deletions

4
env.sh
View File

@ -45,8 +45,8 @@ fi
win() { printf 'Z:%s' "${1//\//\\}"; }
patched() {
git -C "$1" diff --full-index --ignore-submodules=dirty HEAD
git -C "$1" submodule -q foreach --recursive 'git diff --full-index --ignore-submodules=dirty HEAD'
git -C "$1" diff "${2:---full-index}" --ignore-submodules=dirty HEAD
git -C "$1" submodule -q foreach --recursive "git diff ${2:---full-index} --ignore-submodules=dirty HEAD"
}
submodule_of() {

View File

@ -51,7 +51,11 @@ source_of() {
git -C "$dir" remote add origin "$url"
fi
if [ "$(cat "$dir/.git/um-stamp" 2>/dev/null)" = "$stamp" ]; then return; fi
if [ -f "$dir/.git/um-patch" ] && [ "$(patched "$dir" | sha256sum)" != "$(sha256sum < "$dir/.git/um-patch")" ]; then
local saved_patch
if [ -f "$dir/.git/um-patch" ]; then saved_patch=$(sha256sum < "$dir/.git/um-patch"); fi
if [ -f "$dir/.git/um-patch" ] &&
[ "$(patched "$dir" | sha256sum)" != "$saved_patch" ] &&
[ "$(patched "$dir" --abbrev=7 | sha256sum)" != "$saved_patch" ]; then
echo "deps/$name has changes the patch does not: keep them with tools/patch.sh $name"
exit 1
fi