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.