Move GitFetch and GitCommit content enforcement back to Parse2822 (since they have a different format when coming from line-based legacy files)
This commit is contained in:
parent
187e703bbf
commit
3a995f9639
|
|
@ -161,12 +161,6 @@ func (manifest *Manifest2822) AddEntry(entry Manifest2822Entry) error {
|
||||||
if entry.GitRepo == "" || entry.GitFetch == "" || entry.GitCommit == "" {
|
if entry.GitRepo == "" || entry.GitFetch == "" || entry.GitCommit == "" {
|
||||||
return fmt.Errorf("Tags %q missing one of GitRepo, GitFetch, or GitCommit", entry.TagsString())
|
return fmt.Errorf("Tags %q missing one of GitRepo, GitFetch, or GitCommit", entry.TagsString())
|
||||||
}
|
}
|
||||||
if !GitFetchRegex.MatchString(entry.GitFetch) {
|
|
||||||
return fmt.Errorf(`Tags %q has invalid GitFetch (must be "refs/heads/..." or "refs/tags/..."): %q`, entry.TagsString(), entry.GitFetch)
|
|
||||||
}
|
|
||||||
if !GitCommitRegex.MatchString(entry.GitCommit) {
|
|
||||||
return fmt.Errorf(`Tags %q has invalid GitCommit (must be a commit, not a tag or ref): %q`, entry.TagsString(), entry.GitCommit)
|
|
||||||
}
|
|
||||||
if invalidMaintainers := entry.InvalidMaintainers(); len(invalidMaintainers) > 0 {
|
if invalidMaintainers := entry.InvalidMaintainers(); len(invalidMaintainers) > 0 {
|
||||||
return fmt.Errorf("Tags %q has invalid Maintainers: %q (expected format %q)", strings.Join(invalidMaintainers, ", "), MaintainersFormat)
|
return fmt.Errorf("Tags %q has invalid Maintainers: %q (expected format %q)", strings.Join(invalidMaintainers, ", "), MaintainersFormat)
|
||||||
}
|
}
|
||||||
|
|
@ -270,6 +264,13 @@ func Parse2822(readerIn io.Reader) (*Manifest2822, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !GitFetchRegex.MatchString(entry.GitFetch) {
|
||||||
|
return fmt.Errorf(`Tags %q has invalid GitFetch (must be "refs/heads/..." or "refs/tags/..."): %q`, entry.TagsString(), entry.GitFetch)
|
||||||
|
}
|
||||||
|
if !GitCommitRegex.MatchString(entry.GitCommit) {
|
||||||
|
return fmt.Errorf(`Tags %q has invalid GitCommit (must be a commit, not a tag or ref): %q`, entry.TagsString(), entry.GitCommit)
|
||||||
|
}
|
||||||
|
|
||||||
err = manifest.AddEntry(entry)
|
err = manifest.AddEntry(entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue