xwp / wp-dev-lib

DEPRECATED. Common code used during development of WordPress plugins and themes
MIT License
279 stars 58 forks source link

On Travis: fatal: Invalid symmetric difference expression master... #312

Open kasparsd opened 4 years ago

kasparsd commented 4 years ago

Some Travis runs use an invalid diff range during travis.install.sh which results in the following error:

$ source "$DEV_LIB_PATH/travis.install.sh"
git diff master...2abbda3a1c6b90a0173e832e250ce2007e3fd074
fatal: Invalid symmetric difference expression master...2abbda3a1c6b90a0173e832e250ce2007e3fd074

See this sample CI run while the previous without the error and could resolve the diff:

4.63s$ source "$DEV_LIB_PATH/travis.install.sh"
git diff master...a6bb9a704a687f08b748c47975cdc753331a7683
Downloading PHPUnit 7 phar
Cloning into '/tmp/wpcs'...
remote: Enumerating objects: 16677, done.
remote: Total 16677 (delta 0), reused 0 (delta 0), pack-reused 16677
Receiving objects: 100% (16677/16677), 3.98 MiB | 17.65 MiB/s, done.
Resolving deltas: 100% (11626/11626), done.

Note that both are valid ranges:

kasparsd commented 4 years ago

This could be a Travis issue, too. I'm not sure.

kasparsd commented 4 years ago

OK, so this happens only for merge commits like https://github.com/WordPress/application-passwords/commit/2abbda3a1c6b90a0173e832e250ce2007e3fd074 (here is the Travis CI run for that commit).

kasparsd commented 4 years ago

Per https://help.github.com/en/github/committing-changes-to-your-project/commit-exists-on-github-but-not-in-my-local-clone

The branch that contains the commit was deleted, so the commit is no longer referenced.

kasparsd commented 4 years ago

Re-opening since we should probably return a non-zero exit code when this happens. Otherwise the builds appear to pass.

irmalcol commented 4 years ago

I'm also getting this error on Travis builds triggered by GitHub pull requests using the travis.install.sh script. Sometimes the error shows up and sometimes it doesn't. I have not been able to reliably reproduce or avoid the conditions that cause the error to present itself.

git diff master...b5420ec79e7ad76b5fb9d1b743ae35c01c5f82b0
fatal: Invalid symmetric difference expression master...b5420ec79e7ad76b5fb9d1b743ae35c01c5f82b0

This has actually been a problem for a few years now, but I just found this GitHub issue. @kasparsd, were you ever able to determine whether this was a user-related configuration problem, a Travis problem, or a problem with the check-diff.sh script?

AdrienStrathcom commented 4 years ago

@kasparsd, you might want to check out the following Travis bug:

https://github.com/travis-ci/travis-ci/issues/2666

I've been digging into this with @irmalcol, and it seems like this bug is still an issue, despite the Travis team closing the bug. We're trying a workaround along the lines of what's mentioned in the bug:

before_install:
    - export TRAVIS_COMMIT=$(git rev-parse FETCH_HEAD)

Preliminary results look promising, but the issue was intermittent, so need to keep an eye on it.