Page MenuHomePhabricator

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

Authored by jasonbcox on Dec 4 2019, 21:16.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

While this is a pretty bad idea to have said config, it is an even worse idea to have a unit test depends on user config, not testing the software, yet ran as part as its test suite by default, running a buggy script.

It is also unclear if this kind of setup needs to be supported at all. After all, a bot should have its own version of the repository with its own setup.

This revision is now accepted and ready to land.Dec 4 2019, 23:29