Skip to content

Commit 0c8ccdb

Browse files
committed
Git: Pass options from base classes
1 parent 8e3b2f4 commit 0c8ccdb

File tree

2 files changed

+78
-78
lines changed

2 files changed

+78
-78
lines changed

lib/git.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,24 @@
3434
# and more. You should be able to do most fundamental git
3535
# operations with this library.
3636
#
37-
# This module provides the basic functions to open a git
37+
# This module provides the basic functions to open a git
3838
# reference to work with. You can open a working directory,
3939
# open a bare repository, initialize a new repo or clone an
4040
# existing remote repository.
4141
#
4242
# Author:: Scott Chacon (mailto:schacon@gmail.com)
4343
# License:: MIT License
4444
module Git
45-
45+
4646
#g.config('user.name', 'Scott Chacon') # sets value
4747
#g.config('user.email', 'email@email.com') # sets value
4848
#g.config('user.name') # returns 'Scott Chacon'
4949
#g.config # returns whole config hash
50-
def config(name = nil, value = nil)
50+
def config(name = nil, value = nil, options = {})
5151
lib = Git::Lib.new
5252
if(name && value)
5353
# set value
54-
lib.config_set(name, value)
54+
lib.config_set(name, value, options)
5555
elsif (name)
5656
# return value
5757
lib.config_get(name)
@@ -69,8 +69,8 @@ def self.config
6969
return Base.config
7070
end
7171

72-
def global_config(name = nil, value = nil)
73-
self.class.global_config(name, value)
72+
def global_config(name = nil, value = nil, options = {})
73+
self.class.global_config(name, value, options)
7474
end
7575

7676
# open a bare repository
@@ -82,7 +82,7 @@ def global_config(name = nil, value = nil)
8282
def self.bare(git_dir, options = {})
8383
Base.bare(git_dir, options)
8484
end
85-
85+
8686
# clones a remote repository
8787
#
8888
# options
@@ -110,18 +110,18 @@ def self.export(repository, name, options = {})
110110
repo.checkout("origin/#{options[:branch]}") if options[:branch]
111111
Dir.chdir(repo.dir.to_s) { FileUtils.rm_r '.git' }
112112
end
113-
113+
114114
# Same as g.config, but forces it to be at the global level
115115
#
116116
#g.config('user.name', 'Scott Chacon') # sets value
117117
#g.config('user.email', 'email@email.com') # sets value
118118
#g.config('user.name') # returns 'Scott Chacon'
119119
#g.config # returns whole config hash
120-
def self.global_config(name = nil, value = nil)
120+
def self.global_config(name = nil, value = nil, options = {})
121121
lib = Git::Lib.new(nil, nil)
122122
if(name && value)
123123
# set value
124-
lib.global_config_set(name, value)
124+
lib.global_config_set(name, value, options)
125125
elsif (name)
126126
# return value
127127
lib.global_config_get(name)
@@ -139,8 +139,8 @@ def self.global_config(name = nil, value = nil)
139139
def self.init(working_dir = '.', options = {})
140140
Base.init(working_dir, options)
141141
end
142-
143-
# returns a Hash containing information about the references
142+
143+
# returns a Hash containing information about the references
144144
# of the target repository
145145
#
146146
# @param [String|NilClass] location the target repository location or nil for '.'
@@ -150,7 +150,7 @@ def self.ls_remote(location=nil)
150150
end
151151

152152
# open an existing git working directory
153-
#
153+
#
154154
# this will most likely be the most common way to create
155155
# a git reference, referring to a working directory.
156156
# if not provided in the options, the library will assume
@@ -162,5 +162,5 @@ def self.ls_remote(location=nil)
162162
def self.open(working_dir, options = {})
163163
Base.open(working_dir, options)
164164
end
165-
165+
166166
end

0 commit comments

Comments
 (0)