1
0
Fork 0
mirror of https://github.com/vbatts/git-validation.git synced 2024-11-25 17:45:40 +00:00

Merge pull request #34 from kunalkushwaha/multiple-exclude-pathspec

added support for multiple path in exclude list
This commit is contained in:
Vincent Batts 2018-03-06 14:21:08 -05:00 committed by GitHub
commit 48acb1add0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,9 +66,12 @@ func Check(commit string) ([]byte, error) {
"--no-pager", "log", "--check", "--no-pager", "log", "--check",
fmt.Sprintf("%s^..%s", commit, commit), fmt.Sprintf("%s^..%s", commit, commit),
} }
if exclude := os.Getenv("GIT_CHECK_EXCLUDE"); exclude != "" { if excludeEnvList := os.Getenv("GIT_CHECK_EXCLUDE"); excludeEnvList != "" {
excludeList := strings.Split(excludeEnvList, ":")
for _, exclude := range excludeList {
args = append(args, "--", ".", fmt.Sprintf(":(exclude)%s", exclude)) args = append(args, "--", ".", fmt.Sprintf(":(exclude)%s", exclude))
} }
}
cmd := exec.Command("git", args...) cmd := exec.Command("git", args...)
if debug() { if debug() {
logrus.Infof("[git] cmd: %q", strings.Join(cmd.Args, " ")) logrus.Infof("[git] cmd: %q", strings.Join(cmd.Args, " "))