aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-24 16:24:38 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-24 16:24:38 +0200
commit061e83d4b4aa66c2691b3699a3e770b2a58d26df (patch)
treeab82b815a91054fc498dbd7564cc61322b5fd338 /repository/git.go
parent43bda202fa347e6893671b05376c0e4fcb9196f4 (diff)
downloadgit-bug-061e83d4b4aa66c2691b3699a3e770b2a58d26df.tar.gz
commands: add "bridge rm"
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)