Skip to content

Commit

Permalink
Merge pull request #44 from mithro/travis-fix
Browse files Browse the repository at this point in the history
Fixing detached head issue on Travis.
  • Loading branch information
mithro committed Sep 18, 2017
2 parents 0b2b68c + 47bec93 commit 8359b97
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ install:
- export PATH=$PWD/conda/bin:$PATH
- which sdcc
- sdcc --version
- ./.travis/setup.sh

script:
- make firmware-fx2
Expand All @@ -17,4 +18,4 @@ script:
- make docs

after_success:
- ./.travis-push-docs.sh
- ./.travis/push-docs.sh
File renamed without changes.
20 changes: 20 additions & 0 deletions .travis/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

git fetch --unshallow && git fetch --tags
if [ z"$TRAVIS_BRANCH" != z ]; then
TRAVIS_COMMIT_ACTUAL=$(git log --pretty=format:'%H' -n 1)
echo "Fixing detached head (current $TRAVIS_COMMIT_ACTUAL -> $TRAVIS_COMMIT)"
echo "---------------------------------------------"
git log -n 5 --graph
echo "---------------------------------------------"
git fetch origin $TRAVIS_COMMIT
git branch -v
echo "---------------------------------------------"
git log -n 5 --graph
echo "---------------------------------------------"
git branch -D $TRAVIS_BRANCH || true
git checkout $TRAVIS_COMMIT -b $TRAVIS_BRANCH
git branch -v
fi
9 changes: 0 additions & 9 deletions common/version_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ VID=0x$1
PID=0x$2
DID=0x$3

git fetch --unshallow && git fetch --tags
if [ z"$TRAVIS_BRANCH" != z ]; then
echo "Fixing detached head"
git branch -v
git branch -D $TRAVIS_BRANCH || true
git checkout $TRAVIS_COMMIT -b $TRAVIS_BRANCH
git branch -v
fi

# These must be outside the heredoc below otherwise the script won't error.
COMMIT="$(git log --abbrev-commit --format="%h" -n 1)"
BRANCH="$(git symbolic-ref --short HEAD)"
Expand Down

0 comments on commit 8359b97

Please sign in to comment.