From 1ac6ce302e20d9e5b71e1d9173cf34f1c0b6c597 Mon Sep 17 00:00:00 2001 From: Michal Papis Date: Mon, 21 Jan 2019 12:25:49 +0100 Subject: [PATCH] Allow creating new config entries Git 2.1.2 introduced setting values even if they did not previously exist. The git-ruby library keeps compatibility with Git 1.6, this fixes the problem of older versions not being able to create new values. Signed-off-by: Michal Papis --- lib/git/lib.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index a698cf3e..3d072d47 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -502,10 +502,14 @@ def show(objectish=nil, path=nil) def config_set(name, value) command('config', [name, value]) + rescue Git::GitExecuteError + command('config', ['--add', name, value]) end def global_config_set(name, value) command('config', ['--global', name, value], false) + rescue Git::GitExecuteError + command('config', ['--global', '--add', name, value], false) end # updates the repository index using the working directory content