34
34
# and more. You should be able to do most fundamental git
35
35
# operations with this library.
36
36
#
37
- # This module provides the basic functions to open a git
37
+ # This module provides the basic functions to open a git
38
38
# reference to work with. You can open a working directory,
39
39
# open a bare repository, initialize a new repo or clone an
40
40
# existing remote repository.
41
41
#
42
42
# Author:: Scott Chacon (mailto:schacon@gmail.com)
43
43
# License:: MIT License
44
44
module Git
45
-
45
+
46
46
#g.config('user.name', 'Scott Chacon') # sets value
47
47
#g.config('user.email', 'email@email.com') # sets value
48
48
#g.config('user.name') # returns 'Scott Chacon'
49
49
#g.config # returns whole config hash
50
- def config ( name = nil , value = nil )
50
+ def config ( name = nil , value = nil , options = { } )
51
51
lib = Git ::Lib . new
52
52
if ( name && value )
53
53
# set value
54
- lib . config_set ( name , value )
54
+ lib . config_set ( name , value , options )
55
55
elsif ( name )
56
56
# return value
57
57
lib . config_get ( name )
@@ -69,8 +69,8 @@ def self.config
69
69
return Base . config
70
70
end
71
71
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 )
74
74
end
75
75
76
76
# open a bare repository
@@ -82,7 +82,7 @@ def global_config(name = nil, value = nil)
82
82
def self . bare ( git_dir , options = { } )
83
83
Base . bare ( git_dir , options )
84
84
end
85
-
85
+
86
86
# clones a remote repository
87
87
#
88
88
# options
@@ -110,18 +110,18 @@ def self.export(repository, name, options = {})
110
110
repo . checkout ( "origin/#{ options [ :branch ] } " ) if options [ :branch ]
111
111
Dir . chdir ( repo . dir . to_s ) { FileUtils . rm_r '.git' }
112
112
end
113
-
113
+
114
114
# Same as g.config, but forces it to be at the global level
115
115
#
116
116
#g.config('user.name', 'Scott Chacon') # sets value
117
117
#g.config('user.email', 'email@email.com') # sets value
118
118
#g.config('user.name') # returns 'Scott Chacon'
119
119
#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 = { } )
121
121
lib = Git ::Lib . new ( nil , nil )
122
122
if ( name && value )
123
123
# set value
124
- lib . global_config_set ( name , value )
124
+ lib . global_config_set ( name , value , options )
125
125
elsif ( name )
126
126
# return value
127
127
lib . global_config_get ( name )
@@ -139,8 +139,8 @@ def self.global_config(name = nil, value = nil)
139
139
def self . init ( working_dir = '.' , options = { } )
140
140
Base . init ( working_dir , options )
141
141
end
142
-
143
- # returns a Hash containing information about the references
142
+
143
+ # returns a Hash containing information about the references
144
144
# of the target repository
145
145
#
146
146
# @param [String|NilClass] location the target repository location or nil for '.'
@@ -150,7 +150,7 @@ def self.ls_remote(location=nil)
150
150
end
151
151
152
152
# open an existing git working directory
153
- #
153
+ #
154
154
# this will most likely be the most common way to create
155
155
# a git reference, referring to a working directory.
156
156
# if not provided in the options, the library will assume
@@ -162,5 +162,5 @@ def self.ls_remote(location=nil)
162
162
def self . open ( working_dir , options = { } )
163
163
Base . open ( working_dir , options )
164
164
end
165
-
165
+
166
166
end
0 commit comments