fix/nonascii_attributes #69
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/go-git/go-billy/v5/memfs"
|
||||
"github.com/go-git/go-git/v5/plumbing/format/gitattributes"
|
||||
)
|
||||
|
||||
|
@ -17,11 +16,13 @@ import (
|
|||
// It searches for non-ASCII characters in each file's content and returns a list of paths to files containing non-ASCII characters.
|
||||
func getNonAscii(root string) ([]string, error) {
|
||||
var nonAscii []string
|
||||
fs := memfs.New()
|
||||
rootPath := []string{"./"}
|
||||
var emptyStr []string
|
||||
fs := os.DirFS(".")
|
||||
zzjc123 marked this conversation as resolved
Outdated
|
||||
f, err := fs.Open(".gitattributes")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
attribute, err := gitattributes.ReadPatterns(fs, rootPath)
|
||||
attribute, err := gitattributes.ReadAttributes(f, nil, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -45,7 +46,13 @@ func getNonAscii(root string) ([]string, error) {
|
|||
return nil
|
||||
zzjc123 marked this conversation as resolved
Outdated
张泊明518370910136
commented
Can we check the Can we check the `.gitea` dir now?
|
||||
}
|
||||
|
||||
if _, ret := matcher.Match(rootPath, append(emptyStr, info.Name())); ret {
|
||||
relPath, err := filepath.Rel(root, path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
str := strings.Split(relPath, "/")
|
||||
_, ret := matcher.Match(str, nil)
|
||||
zzjc123 marked this conversation as resolved
Outdated
张泊明518370910136
commented
and can this healthcheck skip be removed now? and can this healthcheck skip be removed now?
周赵嘉程521432910016
commented
no we can't for now. no we can't for now.
张泊明518370910136
commented
what about now? what about now?
周赵嘉程521432910016
commented
what do you mean? for now we still need to copy the healthcheck bin into /w to run for test case. I don't now what's the better solution. what do you mean? for now we still need to copy the healthcheck bin into /w to run for test case. I don't now what's the better solution.
周赵嘉程521432910016
commented
oh sorry, I didn't see your commit. I will try it soon. oh sorry, I didn't see your commit. I will try it soon.
周赵嘉程521432910016
commented
it got fixed. it got fixed.
|
||||
if ret {
|
||||
return nil
|
||||
}
|
||||
|
||||
zzjc123 marked this conversation as resolved
Outdated
张泊明518370910136
commented
this line is too long now, should make it in two lines. this line is too long now, should make it in two lines.
|
||||
|
|
Loading…
Reference in New Issue
Block a user
the naming is weird, we need to think what is
!noAttri
. Just sth likegitattributesExist
.