mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Updates
This commit is contained in:
@@ -398,8 +398,8 @@ show_update_menu() {
|
|||||||
|
|
||||||
show_update_branch_menu() {
|
show_update_branch_menu() {
|
||||||
case $(menu "Branch" "master\ndev" "" "$(omarchy-version-branch)") in
|
case $(menu "Branch" "master\ndev" "" "$(omarchy-version-branch)") in
|
||||||
*master*) omarchy-update-branch master ;;
|
*master*) present_terminal "omarchy-update-branch master" ;;
|
||||||
*dev*) omarchy-update-branch dev ;;
|
*dev*) present_terminal "omarchy-update-branch dev" ;;
|
||||||
*) show_update_menu ;;
|
*) show_update_menu ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,27 @@ if (($# == 0)); then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_branch="$1"
|
branch="$1"
|
||||||
|
|
||||||
# Snapshot before switching branch
|
# Snapshot before switching branch
|
||||||
omarchy-snapshot create || [ $? -eq 127 ]
|
omarchy-snapshot create || [ $? -eq 127 ]
|
||||||
|
|
||||||
# Checkout the new branch
|
if ! git -C "$OMARCHY_PATH" diff --quiet || ! git -C "$OMARCHY_PATH" diff --cached --quiet; then
|
||||||
git -C $OMARCHY_PATH checkout $new_branch --autostash
|
stashed=true
|
||||||
git -C $OMARCHY_PATH diff --check || git -C $OMARCHY_PATH reset --merge
|
git -C "$OMARCHY_PATH" stash push -u -m "Autostash before switching to $branch"
|
||||||
|
else
|
||||||
|
stashed=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Switch branches
|
||||||
|
git -C "$OMARCHY_PATH" switch "$branch"
|
||||||
|
|
||||||
|
# Reapply stash if we made one
|
||||||
|
if [[ $stashed == true ]]; then
|
||||||
|
if ! git -C "$OMARCHY_PATH" stash pop; then
|
||||||
|
echo "⚠️ Conflicts when applying stash — stash kept"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Update the system from the new branch
|
# Update the system from the new branch
|
||||||
omarchy-update-perform
|
omarchy-update-perform
|
||||||
|
|||||||
Reference in New Issue
Block a user