1
0
Fork 0
mirror of https://github.com/vbatts/git-validation.git synced 2024-12-28 08:16:31 +00:00

Merge pull request #13 from wking/explicit-range-implies-no-travis

main: Explicit -range implies -no-travis
This commit is contained in:
Vincent Batts 2017-01-27 09:34:07 -05:00 committed by GitHub
commit 3fd57e3bf5

14
main.go
View file

@ -14,7 +14,7 @@ import (
)
var (
flCommitRange = flag.String("range", "", "use this commit range instead")
flCommitRange = flag.String("range", "", "use this commit range instead (implies -no-travis)")
flListRules = flag.Bool("list-rules", false, "list the rules registered")
flRun = flag.String("run", "", "comma delimited list of rules to run. Defaults to all.")
flVerbose = flag.Bool("v", false, "verbose")
@ -48,11 +48,13 @@ func main() {
}
var commitRange = *flCommitRange
if strings.ToLower(os.Getenv("TRAVIS")) == "true" && !*flNoTravis {
if os.Getenv("TRAVIS_COMMIT_RANGE") != "" {
commitRange = os.Getenv("TRAVIS_COMMIT_RANGE")
} else if os.Getenv("TRAVIS_COMMIT") != "" {
commitRange = os.Getenv("TRAVIS_COMMIT")
if commitRange == "" {
if strings.ToLower(os.Getenv("TRAVIS")) == "true" && !*flNoTravis {
if os.Getenv("TRAVIS_COMMIT_RANGE") != "" {
commitRange = os.Getenv("TRAVIS_COMMIT_RANGE")
} else if os.Getenv("TRAVIS_COMMIT") != "" {
commitRange = os.Getenv("TRAVIS_COMMIT")
}
}
}