aboutsummaryrefslogtreecommitdiffstats
path: root/identity
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-12-08 21:15:06 +0100
committerMichael Muré <batolettre@gmail.com>2019-12-08 21:28:27 +0100
commitb92adfcb5f79f2b32c3dafb0fc3e7f1b753b6197 (patch)
tree69202c4021b10f3ab7b7f5ebf229d501e95c4786 /identity
parent981a4a848b1329da1a73270e27633911f9298bb1 (diff)
downloadgit-bug-b92adfcb5f79f2b32c3dafb0fc3e7f1b753b6197.tar.gz
bridge: huge refactor to accept multiple kind of credentials
Diffstat (limited to 'identity')
-rw-r--r--identity/identity.go20
1 files changed, 4 insertions, 16 deletions
diff --git a/identity/identity.go b/identity/identity.go
index b7d44a4b..ed8e39e0 100644
--- a/identity/identity.go
+++ b/identity/identity.go
@@ -23,7 +23,9 @@ const versionEntryName = "version"
const identityConfigKey = "git-bug.identity"
var ErrNonFastForwardMerge = errors.New("non fast-forward identity merge")
-var ErrNoIdentitySet = errors.New("to interact with bugs, an identity first needs to be created using \"git bug user create\" or \"git bug user adopt\"")
+var ErrNoIdentitySet = errors.New("No identity is set.\n" +
+ "To interact with bugs, an identity first needs to be created using " +
+ "\"git bug user create\"")
var ErrMultipleIdentitiesSet = errors.New("multiple user identities set")
var _ Interface = &Identity{}
@@ -218,22 +220,8 @@ func NewFromGitUser(repo repository.Repo) (*Identity, error) {
return NewIdentity(name, email), nil
}
-// IsUserIdentitySet tell if the user identity is correctly set.
-func IsUserIdentitySet(repo repository.RepoCommon) (bool, error) {
- configs, err := repo.LocalConfig().ReadAll(identityConfigKey)
- if err != nil {
- return false, err
- }
-
- if len(configs) > 1 {
- return false, ErrMultipleIdentitiesSet
- }
-
- return len(configs) == 1, nil
-}
-
// SetUserIdentity store the user identity's id in the git config
-func SetUserIdentity(repo repository.RepoCommon, identity *Identity) error {
+func SetUserIdentity(repo repository.RepoConfig, identity *Identity) error {
return repo.LocalConfig().StoreString(identityConfigKey, identity.Id().String())
}