it works if we remove the following checks.
diff --git a/cmd/zoekt-repo-index/main.go b/cmd/zoekt-repo-index/main.go
index 48ce904..93323b0 100644
--- a/cmd/zoekt-repo-index/main.go
+++ b/cmd/zoekt-repo-index/main.go
@@ -217,20 +217,18 @@ func main() {
hasher.Write([]byte(p))
hasher.Write([]byte(id.String()))
- if id.String() == zero.String() {
- log.Panicf("sub project path %q has zero ID.")
+ if id.String() != zero.String() {
+ repo.Branches = append(repo.Branches, zoekt.RepositoryBranch{
+ Name: br.branch,
+ Version: id.String(),
+ })
+
+ opts.RepositoryDescription.Branches = append(opts.RepositoryDescription.Branches, zoekt.RepositoryBranch{
+ Name: br.branch,
+ Version: fmt.Sprintf("%x", hasher.Sum(nil)),
+ })
}
- repo.Branches = append(repo.Branches, zoekt.RepositoryBranch{
- Name: br.branch,
- Version: id.String(),
- })
}
-
- opts.RepositoryDescription.Branches = append(opts.RepositoryDescription.Branches, zoekt.RepositoryBranch{
- Name: br.branch,
- Version: fmt.Sprintf("%x", hasher.Sum(nil)),
- })
-
}
// key => branch
diff --git a/indexbuilder.go b/indexbuilder.go
index 62ee850..8e81cad 100644
--- a/indexbuilder.go
+++ b/indexbuilder.go
@@ -123,16 +123,6 @@ func (b *IndexBuilder) AddSubRepository(path string, desc *Repository) error {
if len(b.files) > 0 {
return fmt.Errorf("AddSubRepository called after adding files.")
}
- branchEqual := len(b.repo.Branches) == len(desc.Branches)
- if branchEqual {
- for i, b := range b.repo.Branches {
- branchEqual = branchEqual && (b.Name == desc.Branches[i].Name)
- }
- }
-
- if !branchEqual {
- return fmt.Errorf("got subrepository branches %v, want main repository branches %v", desc.Branches, b.repo.Branches)
- }
if err := desc.verify(); err != nil {
return err