10000 Allow creating new config entries by mpapis · Pull Request #398 · ruby-git/ruby-git · GitHub
[go: up one dir, main page]

Skip to content

Allow creating new config entries #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <michal.papis@toptal.com>
  • Loading branch information
mpapis authored and Michal Papis committed Mar 25, 2019
commit 1ac6ce302e20d9e5b71e1d9173cf34f1c0b6c597
4 changes: 4 additions & 0 deletions lib/git/lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0