aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-06-04 00:40:32 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-06-17 23:33:32 +0200
commitee2ca519e62d80531030b4e323d6528293fd3238 (patch)
tree99f94ddb3fd92f959eeeea2ca3526b18ce1fc640 /repository/git.go
parent470996a0cef56551262a2fb436b778d8fe4be941 (diff)
downloadgit-bug-ee2ca519e62d80531030b4e323d6528293fd3238.tar.gz
Changes to Repo.RmConfigs
RmConfigs try to remove key/value or section from keyPrefix
Diffstat (limited to 'repository/git.go')
-rw-r--r--repository/git.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/repository/git.go b/repository/git.go
index 801504f2..c8c45d6a 100644
--- a/repository/git.go
+++ b/repository/git.go
@@ -261,7 +261,12 @@ func (repo *GitRepo) ReadConfigString(key string) (string, error) {
// RmConfigs remove all key/value pair matching the key prefix
func (repo *GitRepo) RmConfigs(keyPrefix string) error {
+ // try to remove key/value pair by key
_, err := repo.runGitCommand("config", "--unset-all", keyPrefix)
+ if err != nil {
+ // try to remove section
+ _, err = repo.runGitCommand("config", "--remove-section", keyPrefix)
+ }
return err
}