Skip to content

Commit

Permalink
Merge pull request #277 from stronk7/dont_rebase_if_already_the_same
Browse files Browse the repository at this point in the history
Don't try any rebase --onto when both repos have matching HEADs
  • Loading branch information
junpataleta authored Aug 9, 2023
2 parents 0baf895 + eca37a5 commit cbc168b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rebase_security/rebase_security.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,16 @@ ${mydir}/../git_garbage_collector/git_garbage_collector.sh
# (NOTE: checkout -B means create if branch doesn't exist or reset if it does.)
$gitcmd checkout -B $securitybranch security/$securitybranch

# If integration.git and security.git HEADs are already the same, there is nothing
# to rebase. Just update lastbased to the very same HEAD and done.
if [ $(git rev-parse integration/$gitbranch) == $(git rev-parse security/$gitbranch) ]; then
info "integration.git and security.git ($gitbranch branch) already match. Nothing to rebase"
info "Both are pointing to $(git rev-parse integration/$gitbranch)"
info "Force pushing updated reference branch:"
$gitcmd push -f security integration/$gitbranch:$referencebranch
exit 0 # We are done!
fi

# Do the magic!
# ABRACADABRA!!🌟
info "Rebasing security branch:"
Expand Down

0 comments on commit cbc168b

Please sign in to comment.