Skip to content
Open
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
4 changes: 2 additions & 2 deletions bin/omarchy-update-dev
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

set -euo pipefail

[[ $OMARCHY_PATH != "/usr/share/omarchy" ]] || exit 0
[[ ${OMARCHY_PATH:-/usr/share/omarchy} != "/usr/share/omarchy" ]] || exit 0

if ! git -C "$OMARCHY_PATH" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
echo "Error: OMARCHY_PATH is not a git checkout: $OMARCHY_PATH" >&2
Expand All @@ -18,4 +18,4 @@ if [[ -z $upstream ]]; then
fi

echo -e "\e[32m\nUpdate Omarchy dev checkout\e[0m"
git -C "$OMARCHY_PATH" pull --ff-only
git -C "$OMARCHY_PATH" pull --ff-only
16 changes: 15 additions & 1 deletion test/shell.d/update-dev-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,20 @@ run_dev_update /usr/share/omarchy
[[ ! -s $git_log ]] || fail "package-backed updates do not invoke git" "$(cat "$git_log")"
pass "package-backed updates skip the dev checkout step"

# Mimic `sudo` wiping the environment: OMARCHY_PATH must not unbound-error under set -u.
: >"$git_log"
if ! env -u OMARCHY_PATH \
TEST_GIT_LOG="$git_log" \
PATH="$stub_bin:$PATH" \
"$ROOT/bin/omarchy-update-dev" >"$test_tmp/unset.out" 2>"$test_tmp/unset.err"; then
fail "unset OMARCHY_PATH exits cleanly (sudo-like)" "$(cat "$test_tmp/unset.err")"
fi
if grep -Fq "OMARCHY_PATH: unbound variable" "$test_tmp/unset.err"; then
fail "unset OMARCHY_PATH does not trip nounset" "$(cat "$test_tmp/unset.err")"
fi
[[ ! -s $git_log ]] || fail "unset OMARCHY_PATH does not invoke git" "$(cat "$git_log")"
pass "unset OMARCHY_PATH (sudo-like) skips without unbound-variable"

: >"$git_log"
run_dev_update "$checkout"
grep -Fx -- "-C $checkout pull --ff-only" "$git_log" >/dev/null ||
Expand All @@ -81,4 +95,4 @@ pass "invalid dev checkout fails with a useful error"

grep -qE '^ *omarchy-update-dev$' "$ROOT/bin/omarchy-update" ||
fail "top-level update includes the dev checkout step"
pass "top-level update includes the dev checkout step"
pass "top-level update includes the dev checkout step"