Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/omarchy-update-dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions test/shell.d/update-dev-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]]
;;
Expand All @@ -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
Expand Down