mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
32 lines
747 B
Go
32 lines
747 B
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package analyze
|
|
|
|
import (
|
|
"path"
|
|
"strings"
|
|
|
|
"github.com/go-enry/go-enry/v2"
|
|
)
|
|
|
|
// 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, ".hanzo/") {
|
|
return false
|
|
}
|
|
return true
|
|
}
|