mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-10-28 13:45:38 +08:00
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.
This commit is contained in:
1 file changed
+1
-1
@@ -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:-""}
|
||||
|
||||
Reference in new issue
Block a user