From 94415927c0f601d769dadc689961d27a9f0eaa71 Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Mon, 5 Oct 2026 13:20:49 +0000 Subject: [PATCH] Fix generate-clijson for a blobless Universe checkout trap: the pinned go-task embedded shell (mvdan.cc/sh v3.13.1) only supports EXIT/ERR, so 'trap ... EXIT HUP INT TERM' aborts the recipe with "invalid signal specification" (exit 2). Use EXIT only. blobs: 'git clone --shared' does not propagate partial-clone/promisor config, so a blobless (filter=blob:none) UNIVERSE_DIR makes the temp checkout fail with "cannot read object" for every file blob not already in the shared object store. Mirror the source's promisor config onto the temp clone's origin so missing blobs are lazily fetched during checkout; no-op for a full checkout. Co-authored-by: Isaac --- Taskfile.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index 2c9229dad51..bf85db4656c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -914,13 +914,31 @@ tasks: - | OPENAPI_SHA="$(tr -d '[:space:]' < "{{.ROOT_DIR}}/.codegen/_openapi_sha")" BUILD_DIR="$(mktemp -d "${TMPDIR:-/tmp}/databricks-cli-universe.XXXXXX")" - trap 'rm -rf -- "$BUILD_DIR"' EXIT HUP INT TERM + # go-task's embedded shell (mvdan.cc/sh) only accepts EXIT/ERR in trap, + # not signal names, so cleanup is on normal/errexit exit only. + trap 'rm -rf -- "$BUILD_DIR"' EXIT echo "Creating temporary Universe checkout at ${OPENAPI_SHA}..." git clone --quiet --shared --no-checkout "{{.UNIVERSE_DIR}}" "$BUILD_DIR/universe" + + # `git clone --shared` does not carry over partial-clone/promisor config. + # If UNIVERSE_DIR is a blobless (filter=blob:none) clone, the shared + # object store lacks the file blobs the checkout below needs, and the + # temp clone has no promisor remote to fetch them on demand. Mirror the + # source's promisor config onto origin (pointed at the upstream remote) + # so missing blobs are lazily fetched during checkout. No-op for a full + # clone, where nothing is missing. + UNIVERSE_REMOTE="$(git -C "{{.UNIVERSE_DIR}}" remote get-url origin)" + UNIVERSE_FILTER="$(git -C "{{.UNIVERSE_DIR}}" config --get remote.origin.partialclonefilter || true)" + if [ -n "$UNIVERSE_FILTER" ]; then + git -C "$BUILD_DIR/universe" remote set-url origin "$UNIVERSE_REMOTE" + git -C "$BUILD_DIR/universe" config remote.origin.promisor true + git -C "$BUILD_DIR/universe" config remote.origin.partialclonefilter "$UNIVERSE_FILTER" + git -C "$BUILD_DIR/universe" config extensions.partialClone origin + fi + if ! git -C "$BUILD_DIR/universe" cat-file -e "${OPENAPI_SHA}^{commit}" 2>/dev/null; then echo "Fetching the missing Universe commit from the upstream remote..." - UNIVERSE_REMOTE="$(git -C "{{.UNIVERSE_DIR}}" remote get-url origin)" git -C "$BUILD_DIR/universe" fetch --no-tags "$UNIVERSE_REMOTE" master fi git -C "$BUILD_DIR/universe" checkout --quiet --detach "$OPENAPI_SHA"