aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
Diffstat (limited to 'repository/git.go')
-rw-r--r--repository/git.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/repository/git.go b/repository/git.go
index 51c4f46b..af251aa2 100644
--- a/repository/git.go
+++ b/repository/git.go
@@ -170,8 +170,14 @@ func (repo *GitRepo) StoreConfig(key string, value string) error {
func (repo *GitRepo) ReadConfigs(keyPrefix string) (map[string]string, error) {
stdout, err := repo.runGitCommand("config", "--get-regexp", keyPrefix)
+ // / \
+ // / ! \
+ // -------
+ //
+ // There can be a legitimate error here, but I see no portable way to
+ // distinguish them from the git error that say "no matching value exist"
if err != nil {
- return nil, err
+ return nil, nil
}
lines := strings.Split(stdout, "\n")
@@ -194,6 +200,13 @@ func (repo *GitRepo) ReadConfigs(keyPrefix string) (map[string]string, error) {
return result, nil
}
+// RmConfigs remove all key/value pair matching the key prefix
+func (repo *GitRepo) RmConfigs(keyPrefix string) error {
+ _, err := repo.runGitCommand("config", "--remove-section", keyPrefix)
+
+ return err
+}
+
// FetchRefs fetch git refs from a remote
func (repo *GitRepo) FetchRefs(remote, refSpec string) (string, error) {
stdout, err := repo.runGitCommand("fetch", remote, refSpec)