MCPcopy Index your code
hub / github.com/git-bug/git-bug / getGhost

Method getGhost

bridge/github/import.go:552–580  ·  view source on GitHub ↗
(ctx context.Context, repo *cache.RepoCache)

Source from the content-addressed store, hash-verified

550}
551
552func (gi *githubImporter) getGhost(ctx context.Context, repo *cache.RepoCache) (*cache.IdentityCache, error) {
553 loginName := "ghost"
554 // Look first in the cache
555 i, err := repo.Identities().ResolveIdentityImmutableMetadata(metaKeyGithubLogin, loginName)
556 if err == nil {
557 return i, nil
558 }
559 if entity.IsErrMultipleMatch(err) {
560 return nil, err
561 }
562 user, err := gi.mediator.User(ctx, loginName)
563 if err != nil {
564 return nil, err
565 }
566 userName := ""
567 if user.Name != nil {
568 userName = string(*user.Name)
569 }
570 return repo.Identities().NewRaw(
571 userName,
572 "",
573 string(user.Login),
574 string(user.AvatarUrl),
575 nil,
576 map[string]string{
577 metaKeyGithubLogin: string(user.Login),
578 },
579 )
580}
581
582// parseId converts the unusable githubv4.ID (an interface{}) into a string
583func parseId(id githubv4.ID) string {

Callers 1

ensurePersonMethod · 0.95

Calls 5

IsErrMultipleMatchFunction · 0.92
IdentitiesMethod · 0.80
UserMethod · 0.80
NewRawMethod · 0.45

Tested by

no test coverage detected