diff options
author | Michael Muré <batolettre@gmail.com> | 2020-07-27 00:14:01 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-09-29 20:42:21 +0200 |
commit | b127481364176ac7ecb56c1604e1460251574859 (patch) | |
tree | 389e4f4596183c009ed53a078ad93bc72d6c4564 /repository/gogit.go | |
parent | d171e11028f5993137a5f83beb7fe002bed866f5 (diff) | |
download | git-bug-b127481364176ac7ecb56c1604e1460251574859.tar.gz |
repository: add access to the system keyring, with fallback on a file
Diffstat (limited to 'repository/gogit.go')
-rw-r--r-- | repository/gogit.go | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/repository/gogit.go b/repository/gogit.go index 71a7e6d0..f115fab5 100644 --- a/repository/gogit.go +++ b/repository/gogit.go @@ -24,6 +24,8 @@ type GoGitRepo struct { clocksMutex sync.Mutex clocks map[string]lamport.Clock + + keyring Keyring } func NewGoGitRepo(path string, clockLoaders []ClockLoader) (*GoGitRepo, error) { @@ -37,10 +39,16 @@ func NewGoGitRepo(path string, clockLoaders []ClockLoader) (*GoGitRepo, error) { return nil, err } + k, err := defaultKeyring() + if err != nil { + return nil, err + } + repo := &GoGitRepo{ - r: r, - path: path, - clocks: make(map[string]lamport.Clock), + r: r, + path: path, + clocks: make(map[string]lamport.Clock), + keyring: k, } for _, loader := range clockLoaders { @@ -154,6 +162,10 @@ func (repo *GoGitRepo) GlobalConfig() Config { panic("go-git doesn't support writing global config") } +func (repo *GoGitRepo) Keyring() Keyring { + return repo.keyring +} + // GetPath returns the path to the repo. func (repo *GoGitRepo) GetPath() string { return repo.path |