aboutsummaryrefslogtreecommitdiffstats
path: root/identity/identity.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-01-19 19:23:31 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:40:21 +0100
commitd10c76469d40f13e27739fd363145e89bf74c3e0 (patch)
treeff613ef1ce9400f8c208d3381bd703b186958aa3 /identity/identity.go
parent844616baf8dc628360942d57fd69f24e298e08da (diff)
downloadgit-bug-d10c76469d40f13e27739fd363145e89bf74c3e0.tar.gz
identity: somewhat getting closer !
Diffstat (limited to 'identity/identity.go')
-rw-r--r--identity/identity.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/identity/identity.go b/identity/identity.go
index 313e3fd7..38729e37 100644
--- a/identity/identity.go
+++ b/identity/identity.go
@@ -16,16 +16,6 @@ const identityRefPattern = "refs/identities/"
const versionEntryName = "version"
const identityConfigKey = "git-bug.identity"
-var ErrIdentityNotExist = errors.New("identity doesn't exist")
-
-type ErrMultipleMatch struct {
- Matching []string
-}
-
-func (e ErrMultipleMatch) Error() string {
- return fmt.Sprintf("Multiple matching identities found:\n%s", strings.Join(e.Matching, "\n"))
-}
-
var _ Interface = &Identity{}
type Identity struct {
@@ -85,8 +75,6 @@ func (i *Identity) UnmarshalJSON(data []byte) error {
return nil
}
-// TODO: load/write from OpBase
-
// Read load an Identity from the identities data available in git
func Read(repo repository.Repo, id string) (*Identity, error) {
i := &Identity{
@@ -230,7 +218,9 @@ func (i *Identity) AddVersion(version *Version) {
i.Versions = append(i.Versions, version)
}
-func (i *Identity) Commit(repo repository.ClockedRepo) error {
+// Write the identity into the Repository. In particular, this ensure that
+// the Id is properly set.
+func (i *Identity) Commit(repo repository.Repo) error {
// Todo: check for mismatch between memory and commited data
var lastCommit git.Hash = ""