0

I'm building my project with two branches (master and dev) on Travis-CI.

I've configured it so that when Travis-CI fails to build my branch dev, it would execute the following command automatically to find the buggy commit for me:

$ git bisect start HEAD master --

However, it immediately outputs:

'master' does not appear to be a valid revision

I just learned that if the local repository has no branch named master, Git will prompt this error.

But how can I figure it out what happened on Travis-CI?


My files are listed as followed:

.travis.yml

language: python
python:
  - "3.6"
# caches `$HOME/.cache/pip`
cache: pip

sudo: false

branches:
  only:
    - master
    - dev

git:
  depth: 3

################## JOB LIFECYCLE ##################

# command to install dependencies
before_intall:
  - python -m pip install -r requirements.txt

install:
  - python setup.py install

# command to run tests
before_script:
  - python -m pytest --version

script:
  - python -m pytest

before_cache:
  - rm -f $HOME/.cache/pip/log/debug.log

after_success:

after_failure:
  - cd test/ && ./bisect.sh

before_deploy:

deploy:

after_deploy:

after_script:

###################################################

matrix:
  fast_finish: true

bisect.sh

#!/bin/bash

EXEC_TEST=pytest

# Run tests automatically
git bisect start HEAD master --
git bisect run $EXEC_TEST

# Logging bisect history
git bisect log

# Quit bisect
git bisect reset

Travis-CI build output:

$ chmod u+x bisect.sh && ./bisect.sh
'master' does not appear to be a valid revision
You need to start by "git bisect start".
You then need to give me at least one good|old and one bad|new revision.
(You can use "git bisect bad|new" and "git bisect good|old" for that.)
We are not bisecting.
We are not bisecting.

Raw log can be found here.

KaiserKatze
  • 1,521
  • 2
  • 20
  • 30
  • Can you include your travis-ci yml file? My suspicion is that you only have remote references and no local branches. In which case, you'd need to specify the remote as part of the branch name, e.g. `origin/master` not just master. Won't know that for sure though unless we see the travis yml file too. – wspurgin Nov 01 '18 at 17:17
  • If you expand the run’s log, you’ll see how Travis fetches revisions in repos. – Ry- Nov 01 '18 at 17:39
  • 1
    Many or even most CI systems tend to use shallow and/or single-clone branches, to avoid copying some part(s) of the Git repository. When they do that, they make the clone useless for some part(s) of the development process. Perhaps there's a way to turn off the shallow and/or single-branch-ness. – torek Nov 01 '18 at 17:39
  • @wspurgin Both `.travis.yml` and `bisect.sh` are included. – KaiserKatze Nov 02 '18 at 03:42
  • @Ry- Travis log has been included. – KaiserKatze Nov 02 '18 at 03:42
  • I mean you should look at the part where it pulls your revision. You’ll see it’s what torek described. – Ry- Nov 02 '18 at 05:50

1 Answers1

2

As torek and Ry have pointed out, most CIs use shallow or single branch clones. From your logs you can see it's doing both.

git clone --depth=3 --branch=dev https://github.com/uupers/vtracer-routines.git

To achieve what you want you'll want to follow the advice of some other SO answers that show how to customize a second clone of the repo in Travis for when you need the full repo (or at least more history) to do operations like bisect.

wspurgin
  • 2,600
  • 2
  • 17
  • 20