diff options
author | Amine <hilalyamine@gmail.com> | 2019-12-10 20:52:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-10 20:52:01 +0100 |
commit | ef6801a37f75fbc5f65b0a5db194b7f88b439e7b (patch) | |
tree | 51ef192a080fd02a1230fd7cb7e8566710e006d2 /identity | |
parent | f1ed857cbd3a253d77b31c0c896fdc4ade40844f (diff) | |
parent | da6591e4807d6aec5f230e8a1efad1e2ef686608 (diff) | |
download | git-bug-ef6801a37f75fbc5f65b0a5db194b7f88b439e7b.tar.gz |
Merge pull request #273 from MichaelMure/user-create-set
cmd: "user create" only assign the user identity if not set
Diffstat (limited to 'identity')
-rw-r--r-- | identity/identity.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/identity/identity.go b/identity/identity.go index ed8e39e0..cd47c1b7 100644 --- a/identity/identity.go +++ b/identity/identity.go @@ -261,6 +261,16 @@ func GetUserIdentity(repo repository.Repo) (*Identity, error) { return i, nil } +// IsUserIdentitySet say if the user has set his identity +func IsUserIdentitySet(repo repository.Repo) (bool, error) { + configs, err := repo.LocalConfig().ReadAll(identityConfigKey) + if err != nil { + return false, err + } + + return len(configs) == 1, nil +} + func (i *Identity) AddVersion(version *Version) { i.versions = append(i.versions, version) } |