1package bug
2
3import (
4 "github.com/MichaelMure/git-bug/identity"
5)
6
7// EnsureIdentities walk the graph of operations and make sure that all Identity
8// are properly loaded. That is, it replace all the IdentityStub with the full
9// Identity, loaded through a Resolver.
10func (bug *Bug) EnsureIdentities(resolver identity.Resolver) error {
11 it := NewOperationIterator(bug)
12
13 for it.Next() {
14 op := it.Value()
15 base := op.base()
16
17 if stub, ok := base.Author.(*identity.IdentityStub); ok {
18 i, err := resolver.ResolveIdentity(stub.Id())
19 if err != nil {
20 return err
21 }
22
23 base.Author = i
24 }
25 }
26 return nil
27}