HomePhabricator

Fix a bug where test-autopatch would fail when the local master branch does not…

Description

Fix a bug where test-autopatch would fail when the local master branch does not have the same HEAD as origin/master

Summary:
This can happen when your remotes are set similar to:

origin  https://github.com/Bitcoin-ABC/bitcoin-abc.git
latest  ssh://vcs@reviews.bitcoinabc.org:2221/source/bitcoin-abc.git

This way, master typically ends up ahead of origin/master.

This patch ensures that the branch being tested against is the same as the branch being pulled from.

Test Plan:

cd $(git rev-parse --show-toplevel)
git rev-parse HEAD~2 > ./.git/refs/remotes/origin/master
./contrib/source-control-tools/test/test-autopatch.sh

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4638

Details