This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / gitutil / readme.go
538 B 22 lines
1package gitutil 2 3import ( 4 "regexp" 5 6 "github.com/go-git/go-git/v5/plumbing/filemode" 7) 8 9var readmePattern = regexp.MustCompile(`(?i)^readme(?:\.[^.]+)?$`) 10 11// IsReadmeFile reports whether name/mode identifies a readme blob. The git 12// mode is checked so directories or symlinks named "readme" are filtered out. 13func IsReadmeFile(name, mode string) bool { 14 if !readmePattern.MatchString(name) { 15 return false 16 } 17 m, err := filemode.New(mode) 18 if err != nil { 19 return false 20 } 21 return m == filemode.Regular || m == filemode.Executable 22}