Skip to content

Commit

Permalink
gp --exclusion new flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sarao1310 committed Jul 16, 2023
1 parent 971f128 commit a19d56f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions artifactory/commands/golang/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,17 @@ func getAbsolutePaths(exclusionPatterns []string) ([]string, error) {
return absolutedPaths, nil
}

func isPathExcluded(path string, excludePathPattern string) (excluded bool, err error) {
// This function receives a path and a regexp.
// It returns trUe is the path received matches the regexp.
// Before the match, thw path is turned into an absolute.
func isPathExcluded(path string, excludePatternsRegexp string) (excluded bool, err error) {
var fullPath string
if len(excludePathPattern) > 0 {
if len(excludePatternsRegexp) > 0 {
fullPath, err = filepath.Abs(path)
if err != nil {
return
}
excluded, err = regexp.MatchString(excludePathPattern, fullPath)
excluded, err = regexp.MatchString(excludePatternsRegexp, fullPath)
}
return
}
Expand Down

0 comments on commit a19d56f

Please sign in to comment.