aboutsummaryrefslogtreecommitdiffstats
path: root/identity/identity.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2021-01-03 23:59:25 +0100
committerMichael Muré <batolettre@gmail.com>2021-02-14 12:19:00 +0100
commit8d63c983c982f93cc48d3996d6bd097ddeeb327f (patch)
tree94d85594e11965f9780df53a5c0c2b2550c02184 /identity/identity.go
parent4ef92efeb905102d37b81fafa0ac2173594ef30a (diff)
downloadgit-bug-8d63c983c982f93cc48d3996d6bd097ddeeb327f.tar.gz
WIP
Diffstat (limited to 'identity/identity.go')
-rw-r--r--identity/identity.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/identity/identity.go b/identity/identity.go
index ef488712..65019041 100644
--- a/identity/identity.go
+++ b/identity/identity.go
@@ -344,7 +344,7 @@ func (i *Identity) Commit(repo repository.ClockedRepo) error {
var commitHash repository.Hash
if lastCommit != "" {
- commitHash, err = repo.StoreCommitWithParent(treeHash, lastCommit)
+ commitHash, err = repo.StoreCommit(treeHash, lastCommit)
} else {
commitHash, err = repo.StoreCommit(treeHash)
}
@@ -518,6 +518,15 @@ func (i *Identity) Keys() []*Key {
return i.lastVersion().keys
}
+// SigningKey return the key that should be used to sign new messages. If no key is available, return nil.
+func (i *Identity) SigningKey() *Key {
+ keys := i.Keys()
+ if len(keys) > 0 {
+ return keys[0]
+ }
+ return nil
+}
+
// ValidKeysAtTime return the set of keys valid at a given lamport time
func (i *Identity) ValidKeysAtTime(clockName string, time lamport.Time) []*Key {
var result []*Key