Skip to content

Commit 8e3b2f4

Browse files
committed
Lib: --add option for git config
1 parent 7dde1c7 commit 8e3b2f4

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

lib/git/lib.rb

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,26 @@ def show(objectish=nil, path=nil)
495495

496496
## WRITE COMMANDS ##
497497

498-
def config_set(name, value)
499-
command('config', [name, value])
498+
def config_set(name, value, options={})
499+
arr_opts = []
500+
501+
arr_opts << '--add' if options[:add]
502+
503+
arr_opts << name
504+
arr_opts << value
505+
506+
command('config', arr_opts)
500507
end
501508

502-
def global_config_set(name, value)
503-
command('config', ['--global', name, value], false)
509+
def global_config_set(name, value, options={})
510+
arr_opts = ['--global']
511+
512+
arr_opts << '--add' if options[:add]
513+
514+
arr_opts << name
515+
arr_opts << value
516+
517+
command('config', arr_opts, false)
504518
end
505519

506520
# updates the repository index using the working directory content

0 commit comments

Comments
 (0)