minad-git 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/git.rb +1 -1
- data/lib/git/lib.rb +12 -18
- metadata +1 -1
data/lib/git.rb
CHANGED
data/lib/git/lib.rb
CHANGED
@@ -169,9 +169,10 @@ module Git
|
|
169
169
|
data = {'blob' => {}, 'tree' => {}}
|
170
170
|
|
171
171
|
command_lines('ls-tree', sha).each do |line|
|
172
|
-
|
173
|
-
|
174
|
-
|
172
|
+
info, file = line.split("\t")
|
173
|
+
mode, type, sha = info.split
|
174
|
+
file = eval(file) if file =~ /^\".*\"$/ # FIXME: This takes care of quoted strings returned from git
|
175
|
+
data[type][file] = {:mode => mode, :sha => sha}
|
175
176
|
end
|
176
177
|
|
177
178
|
data
|
@@ -256,7 +257,7 @@ module Git
|
|
256
257
|
hsh = {:total => {:insertions => 0, :deletions => 0, :lines => 0, :files => 0}, :files => {}}
|
257
258
|
|
258
259
|
command_lines('diff', diff_opts).each do |file|
|
259
|
-
|
260
|
+
insertions, deletions, filename = file.split("\t")
|
260
261
|
hsh[:total][:insertions] += insertions.to_i
|
261
262
|
hsh[:total][:deletions] += deletions.to_i
|
262
263
|
hsh[:total][:lines] = (hsh[:total][:deletions] + hsh[:total][:insertions])
|
@@ -271,8 +272,8 @@ module Git
|
|
271
272
|
def diff_files
|
272
273
|
hsh = {}
|
273
274
|
command_lines('diff-files').each do |line|
|
274
|
-
|
275
|
-
|
275
|
+
info, file = line.split("\t")
|
276
|
+
mode_src, mode_dest, sha_src, sha_dest, type = info.split
|
276
277
|
hsh[file] = {:path => file, :mode_file => mode_src.to_s[1, 7], :mode_index => mode_dest,
|
277
278
|
:sha_file => sha_src, :sha_index => sha_dest, :type => type}
|
278
279
|
end
|
@@ -283,8 +284,8 @@ module Git
|
|
283
284
|
def diff_index(treeish)
|
284
285
|
hsh = {}
|
285
286
|
command_lines('diff-index', treeish).each do |line|
|
286
|
-
|
287
|
-
|
287
|
+
info, file = line.split("\t")
|
288
|
+
mode_src, mode_dest, sha_src, sha_dest, type = info.split
|
288
289
|
hsh[file] = {:path => file, :mode_repo => mode_src.to_s[1, 7], :mode_index => mode_dest,
|
289
290
|
:sha_repo => sha_src, :sha_index => sha_dest, :type => type}
|
290
291
|
end
|
@@ -294,9 +295,9 @@ module Git
|
|
294
295
|
def ls_files
|
295
296
|
hsh = {}
|
296
297
|
command_lines('ls-files', '--stage').each do |line|
|
297
|
-
|
298
|
-
|
299
|
-
file = eval(file) if file =~ /^\".*\"$/ # This takes care of quoted strings returned from git
|
298
|
+
info, file = line.split("\t")
|
299
|
+
mode, sha, stage = info.split
|
300
|
+
file = eval(file) if file =~ /^\".*\"$/ # FIXME: This takes care of quoted strings returned from git
|
300
301
|
hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage}
|
301
302
|
end
|
302
303
|
hsh
|
@@ -318,19 +319,12 @@ module Git
|
|
318
319
|
|
319
320
|
def config_get(name)
|
320
321
|
config_list[name]
|
321
|
-
#command('config', ['--get', name])
|
322
322
|
end
|
323
323
|
|
324
324
|
def config_list
|
325
325
|
config = {}
|
326
326
|
config.merge!(parse_config('~/.gitconfig'))
|
327
327
|
config.merge!(parse_config(File.join(@git_dir, 'config')))
|
328
|
-
#hsh = {}
|
329
|
-
#command_lines('config', ['--list']).each do |line|
|
330
|
-
# (key, value) = line.split('=')
|
331
|
-
# hsh[key] = value
|
332
|
-
#end
|
333
|
-
#hsh
|
334
328
|
end
|
335
329
|
|
336
330
|
def parse_config(file)
|