Skip to content

Commit

Permalink
fix: remove creation of errant HEAD branch on destination
Browse files Browse the repository at this point in the history
  • Loading branch information
rivy committed Oct 2, 2022
1 parent 2fc42df commit 5eacd8a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@ inputs:
destination_ssh_private_key:
description: SSH key used to authenticate with destination ssh url provided (optional if public or https url with authentication)
required: false
update_head:
description: Update HEAD reference
required: false
runs:
using: 'docker'
image: 'Dockerfile'
env:
SSH_PRIVATE_KEY: ${{ inputs.ssh_private_key }}
SOURCE_SSH_PRIVATE_KEY: ${{ inputs.source_ssh_private_key }}
DESTINATION_SSH_PRIVATE_KEY: ${{ inputs.destination_ssh_private_key }}
UPDATE_HEAD: ${{ inputs.update_head }}
args:
- ${{ inputs.source_repo }}
- ${{ inputs.source_branch }}
Expand Down
7 changes: 2 additions & 5 deletions git-sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,8 @@ fi
git remote add destination "$DESTINATION_REPO"

# Pull all branches references down locally so subsequent commands can see them
if [[ -n "$UPDATE_HEAD" && "$UPDATE_HEAD" = true ]]; then
git fetch source '+refs/heads/*:refs/heads/*' --update-head-ok
else
git fetch source '+refs/heads/*:refs/heads/*'
fi
git fetch source '+refs/heads/*:refs/heads/*' --update-head-ok
git remote set-head source -d # remove HEAD; avoids later creation of an erroneous branch named "HEAD" at destination

# Print out all branches
git --no-pager branch -a -vv
Expand Down

0 comments on commit 5eacd8a

Please sign in to comment.