Skip to content

Commit 728ad6f

Browse files
committed
build: tweak update-license.go
1 parent 499d63f commit 728ad6f

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

build/update-license.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var (
4848
"Godeps/", "tests/files/", "build/",
4949
// don't relicense vendored sources
5050
"crypto/sha3/", "crypto/ecies/", "logger/glog/",
51-
"crypto/curve.go",
51+
"crypto/secp256k1/curve.go",
5252
"trie/arc.go",
5353
}
5454

@@ -151,14 +151,24 @@ func main() {
151151
writeLicenses(infoc)
152152
}
153153

154+
func skipFile(path string) bool {
155+
if strings.Contains(path, "/testdata/") {
156+
return true
157+
}
158+
for _, p := range skipPrefixes {
159+
if strings.HasPrefix(path, p) {
160+
return true
161+
}
162+
}
163+
return false
164+
}
165+
154166
func getFiles() []string {
155167
cmd := exec.Command("git", "ls-tree", "-r", "--name-only", "HEAD")
156168
var files []string
157169
err := doLines(cmd, func(line string) {
158-
for _, p := range skipPrefixes {
159-
if strings.HasPrefix(line, p) {
160-
return
161-
}
170+
if skipFile(line) {
171+
return
162172
}
163173
ext := filepath.Ext(line)
164174
for _, wantExt := range extensions {
@@ -283,7 +293,7 @@ func getInfo(files <-chan string, out chan<- *info, wg *sync.WaitGroup) {
283293
// fileInfo finds the lowest year in which the given file was commited.
284294
func fileInfo(file string) (*info, error) {
285295
info := &info{file: file, Year: int64(time.Now().Year())}
286-
cmd := exec.Command("git", "log", "--follow", "--find-copies", "--pretty=format:%ai", "--", file)
296+
cmd := exec.Command("git", "log", "--follow", "--find-renames=80", "--find-copies=80", "--pretty=format:%ai", "--", file)
287297
err := doLines(cmd, func(line string) {
288298
y, err := strconv.ParseInt(line[:4], 10, 64)
289299
if err != nil {

0 commit comments

Comments
 (0)