diff options
Diffstat (limited to 'repository/git.go')
-rw-r--r-- | repository/git.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/repository/git.go b/repository/git.go index 3d756324..85107ba5 100644 --- a/repository/git.go +++ b/repository/git.go @@ -26,6 +26,8 @@ type GitRepo struct { clocksMutex sync.Mutex clocks map[string]lamport.Clock + + keyring Keyring } // LocalConfig give access to the repository scoped configuration @@ -38,6 +40,10 @@ func (repo *GitRepo) GlobalConfig() Config { return newGitConfig(repo, true) } +func (repo *GitRepo) Keyring() Keyring { + return repo.keyring +} + // Run the given git command with the given I/O reader/writers, returning an error if it fails. func (repo *GitRepo) runGitCommandWithIO(stdin io.Reader, stdout, stderr io.Writer, args ...string) error { // make sure that the working directory for the command @@ -83,9 +89,15 @@ func (repo *GitRepo) runGitCommand(args ...string) (string, error) { // NewGitRepo determines if the given working directory is inside of a git repository, // and returns the corresponding GitRepo instance if it is. func NewGitRepo(path string, clockLoaders []ClockLoader) (*GitRepo, error) { + k, err := defaultKeyring() + if err != nil { + return nil, err + } + repo := &GitRepo{ - path: path, - clocks: make(map[string]lamport.Clock), + path: path, + clocks: make(map[string]lamport.Clock), + keyring: k, } // Check the repo and retrieve the root path |