Skip to content

Commit a23edf1

Browse files
authored
Merge pull request #15 from vbatts/fix_range_var
main: default travis commit range is unreliable
2 parents 3fd57e3 + 8a12a8f commit a23edf1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ before_install:
1010
- go get -u github.com/golang/lint/golint
1111
- mkdir -p $GOPATH/src/github.com/vbatts && ln -sf $(pwd) $GOPATH/src/github.com/vbatts/git-validation && go get ./...
1212

13+
before_script:
14+
- echo $TRAVIS_COMMIT
15+
- echo $TRAVIS_BRANCH
16+
- echo $TRAVIS_TAG
17+
- echo $TRAVIS_BUILD_NUMBER
18+
- echo $TRAVIS_REPO_SLUG
19+
1320
install: true
1421

1522
script:
1623
- go vet -x ./...
1724
- golint ./...
1825
- go build .
19-
- go test -v ./...
20-
26+
- go test -v ./...

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ func main() {
5050
var commitRange = *flCommitRange
5151
if commitRange == "" {
5252
if strings.ToLower(os.Getenv("TRAVIS")) == "true" && !*flNoTravis {
53-
if os.Getenv("TRAVIS_COMMIT_RANGE") != "" {
54-
commitRange = os.Getenv("TRAVIS_COMMIT_RANGE")
53+
if os.Getenv("TRAVIS_BRANCH") != "" {
54+
commitRange = fmt.Sprintf("%s..FETCH_HEAD", os.Getenv("TRAVIS_BRANCH"))
5555
} else if os.Getenv("TRAVIS_COMMIT") != "" {
5656
commitRange = os.Getenv("TRAVIS_COMMIT")
5757
}

0 commit comments

Comments
 (0)