From 6cdc17d2292d323a251323d949df7bc4d6f2c8d1 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 14 Oct 2026 13:30:09 +0900 Subject: [PATCH] Pull only the blobs the dev checkout needs Full clones made before the blobless clone policy downloaded every blob in the new history on each update. Convert them once with a filtered fetch so later pulls fetch only what the checkout needs. Co-Authored-By: Claude Opus 5.5 --- bin/omarchy-update-dev | 6 ++++++ test/shell.d/update-dev-test.sh | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/bin/omarchy-update-dev b/bin/omarchy-update-dev index a973246ebe89..a98b28c1e8ac 100755 --- a/bin/omarchy-update-dev +++ b/bin/omarchy-update-dev @@ -18,4 +18,10 @@ if [[ -z $upstream ]]; then fi echo -e "\e[32m\nUpdate Omarchy dev checkout\e[0m" +# A filtered fetch makes a full clone blobless once; git saves the filter, so +# pulls then only fetch the file contents the new checkout needs. +remote=$(git -C "$OMARCHY_PATH" for-each-ref --format='%(upstream:remotename)' "$(git -C "$OMARCHY_PATH" symbolic-ref -q HEAD)") +if git -C "$OMARCHY_PATH" config "remote.$remote.url" >/dev/null && ! git -C "$OMARCHY_PATH" config "remote.$remote.promisor" >/dev/null; then + git -C "$OMARCHY_PATH" fetch --filter=blob:none "$remote" +fi git -C "$OMARCHY_PATH" pull --ff-only diff --git a/test/shell.d/update-dev-test.sh b/test/shell.d/update-dev-test.sh index 68da418a488e..1eeb78cad1b7 100644 --- a/test/shell.d/update-dev-test.sh +++ b/test/shell.d/update-dev-test.sh @@ -36,6 +36,22 @@ case "$1" in ;; esac ;; + symbolic-ref) + echo refs/heads/quattro + ;; + for-each-ref) + echo origin + ;; + config) + case "$2" in + remote.origin.url) echo https://github.com/omacom/omarchy.git ;; + remote.origin.promisor) [[ ${TEST_GIT_PROMISOR:-no} == "yes" ]] && echo true ;; + *) exit 1 ;; + esac + ;; + fetch) + [[ $2 == "--filter=blob:none" && $3 == "origin" ]] + ;; pull) [[ $2 == "--ff-only" ]] ;; @@ -62,8 +78,17 @@ pass "package-backed updates skip the dev checkout step" run_dev_update "$checkout" grep -Fx -- "-C $checkout pull --ff-only" "$git_log" >/dev/null || fail "dev checkout update pulls its upstream with fast-forward only" "$(cat "$git_log")" +grep -Fx -- "-C $checkout fetch --filter=blob:none origin" "$git_log" >/dev/null || + fail "dev checkout update makes a full clone blobless before pulling" "$(cat "$git_log")" pass "dev checkout update pulls its configured upstream" +: >"$git_log" +TEST_GIT_PROMISOR=yes run_dev_update "$checkout" +if grep -q ' fetch ' "$git_log"; then + fail "blobless dev checkout is not fetched again before pulling" "$(cat "$git_log")" +fi +pass "blobless dev checkout only pulls" + : >"$git_log" TEST_GIT_UPSTREAM=none run_dev_update "$checkout" if grep -q ' pull ' "$git_log"; then