Revert "add back subrepo branch validation"
This reverts commit c09f4eb6d5c9fb700b135de323f29d26ed9aa756.
Change-Id: Ifac7d7d1ecbac6abffa07ee95db403410ff93b11
diff --git a/index_test.go b/index_test.go
index 3ff2111..0f84197 100644
--- a/index_test.go
+++ b/index_test.go
@@ -20,7 +20,6 @@
"fmt"
"reflect"
"regexp/syntax"
- "strconv"
"strings"
"testing"
@@ -1261,72 +1260,6 @@
}
}
-func TestNewIndexBuilder(t *testing.T) {
- var branchX100 []RepositoryBranch
- for i := 0; i < 100; i++ {
- branchX100 = append(branchX100, RepositoryBranch{
- Name: strconv.Itoa(i),
- })
- }
-
- cases := []struct {
- name string
- repo Repository
- errS string
- }{{
- name: "empty",
- repo: Repository{},
- }, {
- name: "too-many-branches",
- repo: Repository{
- Branches: branchX100,
- },
- errS: "too many branches",
- }, {
- name: "subrepo-branches",
- repo: Repository{
- Branches: []RepositoryBranch{{
- Name: "dev",
- }},
- SubRepoMap: map[string]*Repository{
- "sub": {
- Branches: []RepositoryBranch{{
- Name: "dev",
- }},
- },
- },
- },
- }, {
- name: "subrepo-mismatch-branches",
- repo: Repository{
- Branches: []RepositoryBranch{{
- Name: "dev",
- }},
- SubRepoMap: map[string]*Repository{
- "sub": {
- Branches: []RepositoryBranch{{
- Name: "main",
- }},
- },
- },
- },
- errS: "got subrepository branches [{main }], want main repository branches [{dev }]",
- }}
-
- for _, tc := range cases {
- t.Run(tc.name, func(t *testing.T) {
- _, err := NewIndexBuilder(&tc.repo)
- var got string
- if err != nil {
- got = err.Error()
- }
- if got != tc.errS {
- t.Fatalf("unexpected error:\nwanted: %s\ngot: %s", tc.errS, got)
- }
- })
- }
-}
-
func TestSearchEither(t *testing.T) {
b := testIndexBuilder(t, nil,
Document{Name: "f1", Content: []byte("bla needle bla")},
diff --git a/indexbuilder.go b/indexbuilder.go
index e316269..3ce7816 100644
--- a/indexbuilder.go
+++ b/indexbuilder.go
@@ -222,9 +222,6 @@
branchEqual = branchEqual && (b.Name == desc.Branches[i].Name)
}
}
- if !branchEqual {
- return fmt.Errorf("got subrepository branches %v, want main repository branches %v", subrepo.Branches, desc.Branches)
- }
}
if len(desc.Branches) > 64 {