Skip to content

Commit

Permalink
Don't try any rebase --onto when both repos have matching HEADs
Browse files Browse the repository at this point in the history
If both integration.git and security.git, for a given branch,
have already the same HEADs, then we don't need to rebase anything,
because they are already the same.

The only option to perform is to update the -lastbased branch to
point to the same HEAD and forget.
  • Loading branch information
stronk7 committed Aug 9, 2023
1 parent 0baf895 commit b7ff357
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 that very same HEAD and forget.
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 b7ff357

Please sign in to comment.