File tree 4 files changed +16
-0
lines changed 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,11 @@ Here are the operations that need read permission only.
153
153
g.show()
154
154
g.show(' HEAD' )
155
155
g.show(' v2.8' , ' README.md' )
156
+
157
+ Git .ls_remote(' https://github.com/schacon/ruby-git.git' ) # returns a hash containing the available references of the repo.
158
+ Git .ls_remote(' /path/to/local/repo' )
159
+ Git .ls_remote() # same as Git.ls_remote('.')
160
+
156
161
```
157
162
158
163
And here are the operations that will need to write to your git repository.
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
'lib/git.rb' ,
30
30
'lib/git/author.rb' ,
31
31
'lib/git/base.rb' ,
32
+ 'lib/git/base/factory.rb' ,
32
33
'lib/git/branch.rb' ,
33
34
'lib/git/branches.rb' ,
34
35
'lib/git/config.rb' ,
Original file line number Diff line number Diff line change @@ -139,6 +139,15 @@ 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
144
+ # of the target repository
145
+ #
146
+ # @param [String|NilClass] location the target repository location or nil for '.'
147
+ # @return [{String=>Hash}] the available references of the target repo.
148
+ def self . ls_remote ( location = nil )
149
+ Git ::Lib . new . ls_remote ( location )
150
+ end
142
151
143
152
# open an existing git working directory
144
153
#
Original file line number Diff line number Diff line change @@ -393,6 +393,7 @@ def ls_files(location=nil)
393
393
end
394
394
395
395
def ls_remote ( location = nil )
396
+ location ||= '.'
396
397
Hash . new { |h , k | h [ k ] = { } } . tap do |hsh |
397
398
command_lines ( 'ls-remote' , [ location ] , false ) . each do |line |
398
399
( sha , info ) = line . split ( "\t " )
You can’t perform that action at this time.
0 commit comments