From 3d6d568dcab52a2ac2a309f05db1ba2a1c169d39 Mon Sep 17 00:00:00 2001 From: Esteban Zimanyi Date: Sun, 23 Aug 2026 03:49:53 +0200 Subject: [PATCH] Check out the commit a pinned binding asks the refresh to derive from resolve_repo clones a sibling at the ref the caller names, and `git clone --branch` takes a branch or a tag, so a commit SHA falls through to the full clone the fallback provides. That clone lands on the default branch, and nothing moved it onto the ref afterwards, so the refresh derived from master's tip while announcing the commit it had been given. A binding that pins reaches this path on every first run: MobilityDuck sets MDB_REF from `_MEOS_REF` in its vcpkg portfile precisely so that the catalog and the libmeos a build links come from one recorded commit, and deriving from the tip instead reintroduces the mismatch the pin exists to prevent. The re-run branch of the same function is unaffected, which is why the defect only shows on a work dir that has no clone yet. The fallback now checks the ref out, as the --branch clone it stands in for already does. --- tools/refresh-binding.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/refresh-binding.sh b/tools/refresh-binding.sh index 6703bfa..81d0027 100755 --- a/tools/refresh-binding.sh +++ b/tools/refresh-binding.sh @@ -106,8 +106,10 @@ resolve_repo() { # name url ref existing_path -> echoes absolute path git -C "$dir" fetch --quiet "$url" "$ref" git -C "$dir" checkout --quiet FETCH_HEAD else + # --branch takes a branch or a tag, so a pinned binding's commit SHA falls through to a + # full clone -- which lands on the default branch and must still be moved onto the ref. git clone --quiet --depth 1 --branch "$ref" "$url" "$dir" 2>/dev/null \ - || git clone --quiet "$url" "$dir" # fall back to full clone for a non-branch ref + || { git clone --quiet "$url" "$dir" && git -C "$dir" checkout --quiet "$ref"; } fi (cd "$dir" && pwd) }