Changeset 1273101 in Klonkt


Ignore:
Timestamp:
06/29/2026 11:38:17 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
aedc00d
Parents:
09a2061
Message:

fix(install): reset to FETCH_HEAD so updates work across branch/refspec (fixes "origin/stable unknown revision")

git fetch origin <branch> only updates FETCH_HEAD, not refs/remotes/origin/<branch>, on a
single-branch/shallow clone (or one originally on a different branch) — so `reset --hard
origin/stable` failed with "fatal: ambiguous argument 'origin/stable'", notably when switching
an existing main install to the stable channel. Reset to FETCH_HEAD instead, which always points
at what was just fetched.

  • scripts/install.sh — both the installer's re-run update step and the generated klonkt-update now reset --hard FETCH_HEAD instead of origin/$KLONKT_BRANCH

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • scripts/install.sh

    r09a2061 r1273101  
    142142  git -C "$KLONKT_DIR" remote set-url origin "$KLONKT_REPO"
    143143  git -C "$KLONKT_DIR" fetch --depth 1 origin "$KLONKT_BRANCH"
    144   git -C "$KLONKT_DIR" reset --hard "origin/$KLONKT_BRANCH"
     144  # Reset to FETCH_HEAD, not origin/$KLONKT_BRANCH: a single-branch/shallow clone (or one
     145  # originally on a different branch, e.g. main → stable) has no origin/<branch> tracking ref,
     146  # so `reset --hard origin/stable` fails with "ambiguous argument". FETCH_HEAD always points
     147  # at what we just fetched, regardless of refspec or which branch the clone started on.
     148  git -C "$KLONKT_DIR" reset --hard FETCH_HEAD
    145149else
    146150  [ -e "$KLONKT_DIR" ] && [ -n "$(ls -A "$KLONKT_DIR" 2>/dev/null)" ] && die "$KLONKT_DIR already exists and is not a git checkout. Pick --dir, or clean it up."
     
    236240B=\$(runuser -u ${KLONKT_USER} -- git -C "\$D" rev-parse HEAD 2>/dev/null || true)
    237241runuser -u ${KLONKT_USER} -- git -C "\$D" fetch --depth 1 origin ${KLONKT_BRANCH}
    238 runuser -u ${KLONKT_USER} -- git -C "\$D" reset --hard origin/${KLONKT_BRANCH}
     242runuser -u ${KLONKT_USER} -- git -C "\$D" reset --hard FETCH_HEAD
    239243A=\$(runuser -u ${KLONKT_USER} -- git -C "\$D" rev-parse HEAD)
    240244if [ "\$B" = "\$A" ]; then
Note: See TracChangeset for help on using the changeset viewer.