forked from hinterland/hearth
feat: vendor gitea 1.16.2
This commit is contained in:
@@ -4,10 +4,28 @@
|
||||
package analyze
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/go-enry/go-enry/v2"
|
||||
)
|
||||
|
||||
// IsVendor returns whether or not path is a vendor path.
|
||||
func IsVendor(path string) bool {
|
||||
return enry.IsVendor(path)
|
||||
// IsVendor returns whether the path is a vendor path.
|
||||
// It uses go-enry's IsVendor function but overrides its detection for certain
|
||||
// special cases that shouldn't be marked as vendored in the diff view.
|
||||
func IsVendor(treePath string) bool {
|
||||
if !enry.IsVendor(treePath) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Override detection for single files
|
||||
basename := path.Base(treePath)
|
||||
switch basename {
|
||||
case ".gitignore", ".gitattributes", ".gitmodules":
|
||||
return false
|
||||
}
|
||||
if strings.HasPrefix(treePath, ".github/") || strings.HasPrefix(treePath, ".gitea/") {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user