mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-07-07 08:51:32 -04: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:
parent
1445342fc9
commit
1fb549b4fe
1 changed files with 1 additions and 1 deletions
|
|
@ -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:-""}
|
||||
|
|
|
|||
Loading…
Reference in a new issue