diff options
author | Michael Muré <batolettre@gmail.com> | 2022-12-22 23:19:31 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2022-12-23 01:41:03 +0100 |
commit | 95911100823b5c809225d664de74ad2d64e91972 (patch) | |
tree | c352848904d82b046646b4074f26b0ce5235fa40 /entities/identity | |
parent | d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e (diff) | |
download | git-bug-95911100823b5c809225d664de74ad2d64e91972.tar.gz |
cache: fix some bugs after refactor
Diffstat (limited to 'entities/identity')
-rw-r--r-- | entities/identity/identity.go | 11 | ||||
-rw-r--r-- | entities/identity/identity_actions.go | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/entities/identity/identity.go b/entities/identity/identity.go index 572d2c14..b0cee43b 100644 --- a/entities/identity/identity.go +++ b/entities/identity/identity.go @@ -19,6 +19,9 @@ const identityRemoteRefPattern = "refs/remotes/%s/identities/" const versionEntryName = "version" const identityConfigKey = "git-bug.identity" +const Typename = "identity" +const Namespace = "identities" + var ErrNonFastForwardMerge = errors.New("non fast-forward identity merge") var ErrNoIdentitySet = errors.New("No identity is set.\n" + "To interact with bugs, an identity first needs to be created using " + @@ -105,7 +108,7 @@ func read(repo repository.Repo, ref string) (*Identity, error) { hashes, err := repo.ListCommits(ref) if err != nil { - return nil, entity.NewErrNotFound("identity") + return nil, entity.NewErrNotFound(Typename) } if len(hashes) == 0 { return nil, fmt.Errorf("empty identity") @@ -170,7 +173,7 @@ func RemoveIdentity(repo repository.ClockedRepo, id entity.Id) error { return err } if len(refs) > 1 { - return entity.NewErrMultipleMatch("identity", entity.RefsToIds(refs)) + return entity.NewErrMultipleMatch(Typename, entity.RefsToIds(refs)) } if len(refs) == 1 { // we have the identity locally @@ -189,7 +192,7 @@ func RemoveIdentity(repo repository.ClockedRepo, id entity.Id) error { return err } if len(remoteRefs) > 1 { - return entity.NewErrMultipleMatch("identity", entity.RefsToIds(refs)) + return entity.NewErrMultipleMatch(Typename, entity.RefsToIds(refs)) } if len(remoteRefs) == 1 { // found the identity in a remote @@ -198,7 +201,7 @@ func RemoveIdentity(repo repository.ClockedRepo, id entity.Id) error { } if len(fullMatches) == 0 { - return entity.NewErrNotFound("identity") + return entity.NewErrNotFound(Typename) } for _, ref := range fullMatches { diff --git a/entities/identity/identity_actions.go b/entities/identity/identity_actions.go index b58bb2d9..13776078 100644 --- a/entities/identity/identity_actions.go +++ b/entities/identity/identity_actions.go @@ -13,12 +13,12 @@ import ( // Fetch retrieve updates from a remote // This does not change the local identities state func Fetch(repo repository.Repo, remote string) (string, error) { - return repo.FetchRefs(remote, "identities") + return repo.FetchRefs(remote, Namespace) } // Push update a remote with the local changes func Push(repo repository.Repo, remote string) (string, error) { - return repo.PushRefs(remote, "identities") + return repo.PushRefs(remote, Namespace) } // Pull will do a Fetch + MergeAll |