From 1fb549b4fed65502b7dd75f9eb71a930fdddb53f Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Thu, 7 May 2026 20:02:17 -0500 Subject: [PATCH] Support detached HEAD in cherry_pick_pull.sh When the repo is in a detached HEAD state (`git checkout origin/master`) the cherrypick script fails with: fatal: ref HEAD is not a symbolic ref because HEAD isn't pointing at a specific branch. The script only needs the current branch in order to return the user to the branch afterwards. We can fallback to tracking the detached HEAD commit so the script returns the user back to the same commit. --- hack/cherry_pick_pull.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/cherry_pick_pull.sh b/hack/cherry_pick_pull.sh index 5fe7c48a838..056ff0dbd3d 100755 --- a/hack/cherry_pick_pull.sh +++ b/hack/cherry_pick_pull.sh @@ -29,7 +29,7 @@ REPO_ROOT="$(git rev-parse --show-toplevel)" declare -r REPO_ROOT cd "${REPO_ROOT}" -STARTINGBRANCH=$(git symbolic-ref --short HEAD) +STARTINGBRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse HEAD) declare -r STARTINGBRANCH declare -r REBASEMAGIC="${REPO_ROOT}/.git/rebase-apply" DRY_RUN=${DRY_RUN:-""}