minad-git 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git/base.rb +43 -43
- data/lib/git/diff.rb +1 -1
- data/lib/git/lib.rb +95 -99
- data/lib/git/log.rb +8 -8
- data/lib/git/status.rb +3 -1
- metadata +4 -4
data/lib/git/base.rb
CHANGED
@@ -4,13 +4,13 @@ module Git
|
|
4
4
|
|
5
5
|
# opens a bare Git Repository - no working directory options
|
6
6
|
def self.bare(git_dir, opts = {})
|
7
|
-
|
7
|
+
new({:repository => git_dir}.merge(opts))
|
8
8
|
end
|
9
9
|
|
10
10
|
# opens a new Git Project from a working directory
|
11
11
|
# you can specify non-standard git_dir and index file in the options
|
12
12
|
def self.open(working_dir, opts={})
|
13
|
-
|
13
|
+
new({:working_directory => working_dir}.merge(opts))
|
14
14
|
end
|
15
15
|
|
16
16
|
# initializes a git repository
|
@@ -30,7 +30,7 @@ module Git
|
|
30
30
|
# run git_init there
|
31
31
|
Git::Lib.new(opts).init
|
32
32
|
|
33
|
-
|
33
|
+
new(opts)
|
34
34
|
end
|
35
35
|
|
36
36
|
# clones a git repository locally
|
@@ -48,7 +48,7 @@ module Git
|
|
48
48
|
#
|
49
49
|
def self.clone(repository, name, opts = {})
|
50
50
|
# run git-clone
|
51
|
-
|
51
|
+
new(Git::Lib.new.clone(repository, name, opts))
|
52
52
|
end
|
53
53
|
|
54
54
|
def initialize(options = {})
|
@@ -187,19 +187,19 @@ module Git
|
|
187
187
|
|
188
188
|
# returns +true+ if the branch exists locally
|
189
189
|
def is_local_branch?(branch)
|
190
|
-
branch_names =
|
190
|
+
branch_names = branches.local.map {|b| b.name}
|
191
191
|
branch_names.include?(branch)
|
192
192
|
end
|
193
193
|
|
194
194
|
# returns +true+ if the branch exists remotely
|
195
195
|
def is_remote_branch?(branch)
|
196
|
-
branch_names =
|
196
|
+
branch_names = branches.local.map {|b| b.name}
|
197
197
|
branch_names.include?(branch)
|
198
198
|
end
|
199
199
|
|
200
200
|
# returns +true+ if the branch exists
|
201
201
|
def is_branch?(branch)
|
202
|
-
branch_names =
|
202
|
+
branch_names = branches.map {|b| b.name}
|
203
203
|
branch_names.include?(branch)
|
204
204
|
end
|
205
205
|
|
@@ -235,7 +235,7 @@ module Git
|
|
235
235
|
# end
|
236
236
|
# end
|
237
237
|
def grep(string, path_limiter = nil, opts = {})
|
238
|
-
|
238
|
+
object('HEAD').grep(string, path_limiter, opts)
|
239
239
|
end
|
240
240
|
|
241
241
|
# returns a Git::Diff object
|
@@ -245,23 +245,23 @@ module Git
|
|
245
245
|
|
246
246
|
# adds files from the working directory to the git repository
|
247
247
|
def add(path = '.')
|
248
|
-
|
248
|
+
lib.add(path)
|
249
249
|
end
|
250
250
|
|
251
251
|
# removes file(s) from the git repository
|
252
252
|
def remove(path = '.', opts = {})
|
253
|
-
|
253
|
+
lib.remove(path, opts)
|
254
254
|
end
|
255
255
|
|
256
256
|
# resets the working directory to the provided commitish
|
257
257
|
def reset(commitish = nil, opts = {})
|
258
|
-
|
258
|
+
lib.reset(commitish, opts)
|
259
259
|
end
|
260
260
|
|
261
261
|
# resets the working directory to the commitish with '--hard'
|
262
262
|
def reset_hard(commitish = nil, opts = {})
|
263
263
|
opts = {:hard => true}.merge(opts)
|
264
|
-
|
264
|
+
lib.reset(commitish, opts)
|
265
265
|
end
|
266
266
|
|
267
267
|
# commits all pending changes in the index file to the git repository
|
@@ -271,7 +271,7 @@ module Git
|
|
271
271
|
# :allow_empty
|
272
272
|
# :author
|
273
273
|
def commit(message, opts = {})
|
274
|
-
|
274
|
+
lib.commit(message, opts)
|
275
275
|
end
|
276
276
|
|
277
277
|
# commits all pending changes in the index file to the git repository,
|
@@ -279,23 +279,23 @@ module Git
|
|
279
279
|
# calling @git.add() on them.
|
280
280
|
def commit_all(message, opts = {})
|
281
281
|
opts = {:add_all => true}.merge(opts)
|
282
|
-
|
282
|
+
lib.commit(message, opts)
|
283
283
|
end
|
284
284
|
|
285
285
|
# checks out a branch as the new git working directory
|
286
286
|
def checkout(branch = 'master', opts = {})
|
287
|
-
|
287
|
+
lib.checkout(branch, opts)
|
288
288
|
end
|
289
289
|
|
290
290
|
# checks out an old version of a file
|
291
291
|
def checkout_file(version, file)
|
292
|
-
|
292
|
+
lib.checkout_file(version,file)
|
293
293
|
end
|
294
294
|
|
295
295
|
# fetches changes from a remote branch - this does not modify the working directory,
|
296
296
|
# it just gets the changes from the remote if there are any
|
297
297
|
def fetch(remote = 'origin')
|
298
|
-
|
298
|
+
lib.fetch(remote)
|
299
299
|
end
|
300
300
|
|
301
301
|
# pushes changes to a remote repository - easiest if this is a cloned repository,
|
@@ -304,19 +304,19 @@ module Git
|
|
304
304
|
# @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master')
|
305
305
|
#
|
306
306
|
def push(remote = 'origin', branch = 'master', tags = false)
|
307
|
-
|
307
|
+
lib.push(remote, branch, tags)
|
308
308
|
end
|
309
309
|
|
310
310
|
# merges one or more branches into the current working branch
|
311
311
|
#
|
312
312
|
# you can specify more than one branch to merge by passing an array of branches
|
313
313
|
def merge(branch, message = 'merge')
|
314
|
-
|
314
|
+
lib.merge(branch, message)
|
315
315
|
end
|
316
316
|
|
317
317
|
# iterates over the files which are unmerged
|
318
318
|
def each_conflict(&block) # :yields: file, your_version, their_version
|
319
|
-
|
319
|
+
lib.conflicts(&block)
|
320
320
|
end
|
321
321
|
|
322
322
|
# fetches a branch from a remote and merges it into the current working branch
|
@@ -327,7 +327,7 @@ module Git
|
|
327
327
|
|
328
328
|
# returns an array of Git:Remote objects
|
329
329
|
def remotes
|
330
|
-
|
330
|
+
lib.remotes.map { |r| Git::Remote.new(self, r) }
|
331
331
|
end
|
332
332
|
|
333
333
|
# adds a new remote to this repository
|
@@ -339,13 +339,13 @@ module Git
|
|
339
339
|
#
|
340
340
|
def add_remote(name, url, opts = {})
|
341
341
|
url = url.repo.path if url.is_a?(Git::Base)
|
342
|
-
|
342
|
+
lib.remote_add(name, url, opts)
|
343
343
|
Git::Remote.new(self, name)
|
344
344
|
end
|
345
345
|
|
346
346
|
# returns an array of all Git::Tag objects for this repository
|
347
347
|
def tags
|
348
|
-
|
348
|
+
lib.tags.map { |r| tag(r) }
|
349
349
|
end
|
350
350
|
|
351
351
|
# returns a Git::Tag object
|
@@ -355,32 +355,32 @@ module Git
|
|
355
355
|
|
356
356
|
# creates a new git tag (Git::Tag)
|
357
357
|
def add_tag(tag_name)
|
358
|
-
|
358
|
+
lib.tag(tag_name)
|
359
359
|
tag(tag_name)
|
360
360
|
end
|
361
361
|
|
362
362
|
# creates an archive file of the given tree-ish
|
363
363
|
def archive(treeish, file = nil, opts = {})
|
364
|
-
|
364
|
+
object(treeish).archive(file, opts)
|
365
365
|
end
|
366
366
|
|
367
367
|
# repacks the repository
|
368
368
|
def repack
|
369
|
-
|
369
|
+
lib.repack
|
370
370
|
end
|
371
371
|
|
372
372
|
def gc
|
373
|
-
|
373
|
+
lib.gc
|
374
374
|
end
|
375
375
|
|
376
376
|
def apply(file)
|
377
377
|
if File.exists?(file)
|
378
|
-
|
378
|
+
lib.apply(file)
|
379
379
|
end
|
380
380
|
end
|
381
381
|
|
382
382
|
def apply_mail(file)
|
383
|
-
|
383
|
+
lib.apply_mail(file) if File.exists?(file)
|
384
384
|
end
|
385
385
|
|
386
386
|
## LOWER LEVEL INDEX OPERATIONS ##
|
@@ -388,9 +388,9 @@ module Git
|
|
388
388
|
def with_index(new_index) # :yields: new_index
|
389
389
|
old_index = @index
|
390
390
|
set_index(new_index, false)
|
391
|
-
|
391
|
+
result = yield @index
|
392
392
|
set_index(old_index)
|
393
|
-
|
393
|
+
result
|
394
394
|
end
|
395
395
|
|
396
396
|
def with_temp_index &blk
|
@@ -401,19 +401,19 @@ module Git
|
|
401
401
|
end
|
402
402
|
|
403
403
|
def checkout_index(opts = {})
|
404
|
-
|
404
|
+
lib.checkout_index(opts)
|
405
405
|
end
|
406
406
|
|
407
407
|
def read_tree(treeish, opts = {})
|
408
|
-
|
408
|
+
lib.read_tree(treeish, opts)
|
409
409
|
end
|
410
410
|
|
411
411
|
def write_tree
|
412
|
-
|
412
|
+
lib.write_tree
|
413
413
|
end
|
414
414
|
|
415
415
|
def commit_tree(tree = nil, opts = {})
|
416
|
-
Git::Object::Commit.new(self,
|
416
|
+
Git::Object::Commit.new(self, lib.commit_tree(tree, opts))
|
417
417
|
end
|
418
418
|
|
419
419
|
def write_and_commit_tree(opts = {})
|
@@ -427,18 +427,18 @@ module Git
|
|
427
427
|
|
428
428
|
|
429
429
|
def ls_files
|
430
|
-
|
430
|
+
lib.ls_files
|
431
431
|
end
|
432
432
|
|
433
433
|
def with_working(work_dir) # :yields: the working directory
|
434
|
-
|
434
|
+
result = false
|
435
435
|
old_working = @working_directory
|
436
436
|
set_working(work_dir)
|
437
437
|
Dir.chdir work_dir do
|
438
|
-
|
438
|
+
result = yield @working_directory
|
439
439
|
end
|
440
440
|
set_working(old_working)
|
441
|
-
|
441
|
+
result
|
442
442
|
end
|
443
443
|
|
444
444
|
def with_temp_working &blk
|
@@ -457,20 +457,20 @@ module Git
|
|
457
457
|
# @git.revparse('v2.4:/doc/index.html')
|
458
458
|
#
|
459
459
|
def revparse(objectish)
|
460
|
-
|
460
|
+
lib.revparse(objectish)
|
461
461
|
end
|
462
462
|
|
463
463
|
def ls_tree(objectish)
|
464
|
-
|
464
|
+
lib.ls_tree(objectish)
|
465
465
|
end
|
466
466
|
|
467
467
|
def cat_file(objectish)
|
468
|
-
|
468
|
+
lib.object_contents(objectish)
|
469
469
|
end
|
470
470
|
|
471
471
|
# returns the name of the branch the working directory is currently on
|
472
472
|
def current_branch
|
473
|
-
|
473
|
+
lib.branch_current
|
474
474
|
end
|
475
475
|
|
476
476
|
|
data/lib/git/diff.rb
CHANGED
data/lib/git/lib.rb
CHANGED
@@ -45,16 +45,14 @@ module Git
|
|
45
45
|
@path = opts[:path] || '.'
|
46
46
|
clone_dir = opts[:path] ? File.join(@path, name) : name
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
args = []
|
49
|
+
args << "--bare" if opts[:bare]
|
50
|
+
args << "-o" << opts[:remote] if opts[:remote]
|
51
|
+
args << "--depth" << opts[:depth].to_i if opts[:depth] && opts[:depth].to_i > 0
|
52
52
|
|
53
|
-
|
54
|
-
arr_opts << repository
|
55
|
-
arr_opts << clone_dir
|
53
|
+
args << '--' << repository << clone_dir
|
56
54
|
|
57
|
-
command('clone',
|
55
|
+
command('clone', args)
|
58
56
|
|
59
57
|
opts[:bare] ? {:repository => clone_dir} : {:working_directory => clone_dir}
|
60
58
|
end
|
@@ -64,32 +62,32 @@ module Git
|
|
64
62
|
|
65
63
|
|
66
64
|
def log_commits(opts = {})
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
65
|
+
args = ['--pretty=oneline']
|
66
|
+
args << "-#{opts[:count]}" if opts[:count]
|
67
|
+
args << "--since=#{opts[:since]}" if opts[:since].is_a? String
|
68
|
+
args << "--until=#{opts[:until]}" if opts[:until].is_a? String
|
69
|
+
args << "--grep=#{opts[:grep]}" if opts[:grep].is_a? String
|
70
|
+
args << "--author=#{opts[:author]}" if opts[:author].is_a? String
|
71
|
+
args << "#{opts[:between][0].to_s}..#{opts[:between][1].to_s}" if (opts[:between] && opts[:between].size == 2)
|
72
|
+
args << opts[:object] if opts[:object].is_a? String
|
73
|
+
args << '--' << opts[:path_limiter] if opts[:path_limiter].is_a? String
|
76
74
|
|
77
|
-
command_lines('log',
|
75
|
+
command_lines('log', args, true).map { |l| l.split.first }
|
78
76
|
end
|
79
77
|
|
80
78
|
def full_log_commits(opts = {})
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
full_log = command_lines('log',
|
79
|
+
args = ['--pretty=raw']
|
80
|
+
args << "-#{opts[:count]}" if opts[:count]
|
81
|
+
args << "--skip=#{opts[:skip]}" if opts[:skip]
|
82
|
+
args << "--since=#{opts[:since]}" if opts[:since].is_a? String
|
83
|
+
args << "--until=#{opts[:until]}" if opts[:until].is_a? String
|
84
|
+
args << "--grep=#{opts[:grep]}" if opts[:grep].is_a? String
|
85
|
+
args << "--author=#{opts[:author]}" if opts[:author].is_a? String
|
86
|
+
args << "#{opts[:between][0].to_s}..#{opts[:between][1].to_s}" if (opts[:between] && opts[:between].size == 2)
|
87
|
+
args << opts[:object] if opts[:object].is_a? String
|
88
|
+
args << '--' << opts[:path_limiter] if opts[:path_limiter].is_a? String
|
89
|
+
|
90
|
+
full_log = command_lines('log', args, true)
|
93
91
|
process_commit_data(full_log)
|
94
92
|
end
|
95
93
|
|
@@ -298,11 +296,15 @@ module Git
|
|
298
296
|
command_lines('ls-files', '--stage').each do |line|
|
299
297
|
(info, file) = line.split("\t")
|
300
298
|
(mode, sha, stage) = info.split
|
299
|
+
file = eval(file) if file =~ /^\".*\"$/ # This takes care of quoted strings returned from git
|
301
300
|
hsh[file] = {:path => file, :mode_index => mode, :sha_index => sha, :stage => stage}
|
302
301
|
end
|
303
302
|
hsh
|
304
303
|
end
|
305
304
|
|
305
|
+
def ignored_files
|
306
|
+
command_lines('ls-files', ['--others', '-i', '--exclude-standard'])
|
307
|
+
end
|
306
308
|
|
307
309
|
def config_remote(name)
|
308
310
|
hsh = {}
|
@@ -357,41 +359,41 @@ module Git
|
|
357
359
|
end
|
358
360
|
|
359
361
|
def add(path = '.')
|
360
|
-
|
362
|
+
args = ['--']
|
361
363
|
if path.is_a?(Array)
|
362
|
-
|
364
|
+
args += path
|
363
365
|
else
|
364
|
-
|
366
|
+
args << path
|
365
367
|
end
|
366
|
-
command('add',
|
368
|
+
command('add', args)
|
367
369
|
end
|
368
370
|
|
369
371
|
def remove(path = '.', opts = {})
|
370
|
-
|
371
|
-
|
372
|
-
|
372
|
+
args = ['-f'] # overrides the up-to-date check by default
|
373
|
+
args << '-r' if opts[:recursive]
|
374
|
+
args << '--'
|
373
375
|
if path.is_a?(Array)
|
374
|
-
|
376
|
+
args += path
|
375
377
|
else
|
376
|
-
|
378
|
+
args << path
|
377
379
|
end
|
378
380
|
|
379
|
-
command('rm',
|
381
|
+
command('rm', args)
|
380
382
|
end
|
381
383
|
|
382
384
|
def commit(message, opts = {})
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
command('commit',
|
385
|
+
args = ['-m', message]
|
386
|
+
args << '-a' if opts[:add_all]
|
387
|
+
args << '--allow-empty' if opts[:allow_empty]
|
388
|
+
args << "--author" << opts[:author] if opts[:author]
|
389
|
+
command('commit', args)
|
388
390
|
end
|
389
391
|
|
390
392
|
def reset(commit, opts = {})
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
command('reset',
|
393
|
+
args = []
|
394
|
+
args << '--hard' if opts[:hard]
|
395
|
+
args << commit if commit
|
396
|
+
command('reset', args)
|
395
397
|
end
|
396
398
|
|
397
399
|
def revert(commit)
|
@@ -399,15 +401,15 @@ module Git
|
|
399
401
|
end
|
400
402
|
|
401
403
|
def apply(patch_file)
|
402
|
-
|
403
|
-
|
404
|
-
command('apply',
|
404
|
+
args = []
|
405
|
+
args << '--' << patch_file if patch_file
|
406
|
+
command('apply', args)
|
405
407
|
end
|
406
408
|
|
407
409
|
def apply_mail(patch_file)
|
408
|
-
|
409
|
-
|
410
|
-
command('am',
|
410
|
+
args = []
|
411
|
+
args << '--' << patch_file if patch_file
|
412
|
+
command('am', args)
|
411
413
|
end
|
412
414
|
|
413
415
|
def stashes_all
|
@@ -452,26 +454,23 @@ module Git
|
|
452
454
|
end
|
453
455
|
|
454
456
|
def checkout(branch, opts = {})
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
457
|
+
args = []
|
458
|
+
args << '-f' if opts[:force]
|
459
|
+
args << '-b' << opts[:new_branch] if opts[:new_branch]
|
460
|
+
args << branch
|
459
461
|
|
460
|
-
command('checkout',
|
462
|
+
command('checkout', args)
|
461
463
|
end
|
462
464
|
|
463
465
|
def checkout_file(version, file)
|
464
|
-
|
465
|
-
arr_opts << version
|
466
|
-
arr_opts << file
|
467
|
-
command('checkout', arr_opts)
|
466
|
+
command('checkout', [version, '--', file])
|
468
467
|
end
|
469
468
|
|
470
469
|
def merge(branch, message = nil)
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
command('merge',
|
470
|
+
args = []
|
471
|
+
args << '-m' << message if message
|
472
|
+
args += [branch]
|
473
|
+
command('merge', args)
|
475
474
|
end
|
476
475
|
|
477
476
|
def unmerged
|
@@ -494,13 +493,11 @@ module Git
|
|
494
493
|
end
|
495
494
|
|
496
495
|
def remote_add(name, url, opts = {})
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
arr_opts << name
|
501
|
-
arr_opts << url
|
496
|
+
args = ['add']
|
497
|
+
args << '-f' if opts[:with_fetch]
|
498
|
+
args << '--' << name << url
|
502
499
|
|
503
|
-
command('remote',
|
500
|
+
command('remote', args)
|
504
501
|
end
|
505
502
|
|
506
503
|
# this is documented as such, but seems broken for some reason
|
@@ -548,10 +545,10 @@ module Git
|
|
548
545
|
|
549
546
|
# reads a tree into the current index file
|
550
547
|
def read_tree(treeish, opts = {})
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
command('read-tree',
|
548
|
+
args = []
|
549
|
+
args << "--prefix=#{opts[:prefix]}" if opts[:prefix]
|
550
|
+
args += [treeish]
|
551
|
+
command('read-tree', args)
|
555
552
|
end
|
556
553
|
|
557
554
|
def write_tree
|
@@ -564,11 +561,10 @@ module Git
|
|
564
561
|
t.write(opts[:message])
|
565
562
|
t.close
|
566
563
|
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
command('commit-tree', arr_opts, true, "< #{escape t.path}")
|
564
|
+
args = [tree]
|
565
|
+
args << '-p' << opts[:parent] if opts[:parent]
|
566
|
+
args += [opts[:parents]].map { |p| ['-p', p] }.flatten if opts[:parents]
|
567
|
+
command('commit-tree', args, true, "< #{escape t.path}")
|
572
568
|
end
|
573
569
|
|
574
570
|
def update_ref(branch, commit)
|
@@ -576,13 +572,13 @@ module Git
|
|
576
572
|
end
|
577
573
|
|
578
574
|
def checkout_index(opts = {})
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
575
|
+
args = []
|
576
|
+
args << "--prefix=#{opts[:prefix]}" if opts[:prefix]
|
577
|
+
args << "--force" if opts[:force]
|
578
|
+
args << "--all" if opts[:all]
|
579
|
+
args << '--' << opts[:path_limiter] if opts[:path_limiter].is_a? String
|
584
580
|
|
585
|
-
command('checkout-index',
|
581
|
+
command('checkout-index', args)
|
586
582
|
end
|
587
583
|
|
588
584
|
# creates an archive file
|
@@ -602,13 +598,13 @@ module Git
|
|
602
598
|
|
603
599
|
file ||= Tempfile.new('archive').path
|
604
600
|
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
command('archive',
|
601
|
+
args = []
|
602
|
+
args << "--format=#{opts[:format]}" if opts[:format]
|
603
|
+
args << "--prefix=#{opts[:prefix]}" if opts[:prefix]
|
604
|
+
args << "--remote=#{opts[:remote]}" if opts[:remote]
|
605
|
+
args << sha
|
606
|
+
args << '--' << opts[:path] if opts[:path]
|
607
|
+
command('archive', args, true, (opts[:add_gzip] ? '| gzip' : '') + " > #{escape file}")
|
612
608
|
return file
|
613
609
|
end
|
614
610
|
|
@@ -618,14 +614,14 @@ module Git
|
|
618
614
|
command(cmd, opts, chdir).split("\n")
|
619
615
|
end
|
620
616
|
|
621
|
-
def command(cmd,
|
617
|
+
def command(cmd, args = [], chdir = true, redirect = '', &block)
|
622
618
|
ENV['GIT_DIR'] = @git_dir
|
623
619
|
ENV['GIT_INDEX_FILE'] = @git_index_file
|
624
620
|
ENV['GIT_WORK_TREE'] = @git_work_dir
|
625
621
|
path = @git_work_dir || @git_dir || @path
|
626
622
|
|
627
|
-
|
628
|
-
git_cmd = "git #{cmd} #{
|
623
|
+
args = [args].flatten.map {|s| escape(s) }.join(' ')
|
624
|
+
git_cmd = "git #{cmd} #{args} #{redirect} 2>&1"
|
629
625
|
|
630
626
|
out = nil
|
631
627
|
if chdir && (Dir.getwd != path)
|
data/lib/git/log.rb
CHANGED
@@ -23,49 +23,49 @@ module Git
|
|
23
23
|
def object(objectish)
|
24
24
|
dirty_log
|
25
25
|
@object = objectish
|
26
|
-
|
26
|
+
self
|
27
27
|
end
|
28
28
|
|
29
29
|
def author(regex)
|
30
30
|
dirty_log
|
31
31
|
@author = regex
|
32
|
-
|
32
|
+
self
|
33
33
|
end
|
34
34
|
|
35
35
|
def grep(regex)
|
36
36
|
dirty_log
|
37
37
|
@grep = regex
|
38
|
-
|
38
|
+
self
|
39
39
|
end
|
40
40
|
|
41
41
|
def path(path)
|
42
42
|
dirty_log
|
43
43
|
@path = path
|
44
|
-
|
44
|
+
self
|
45
45
|
end
|
46
46
|
|
47
47
|
def skip(num)
|
48
48
|
dirty_log
|
49
49
|
@skip = num
|
50
|
-
|
50
|
+
self
|
51
51
|
end
|
52
52
|
|
53
53
|
def since(date)
|
54
54
|
dirty_log
|
55
55
|
@since = date
|
56
|
-
|
56
|
+
self
|
57
57
|
end
|
58
58
|
|
59
59
|
def until(date)
|
60
60
|
dirty_log
|
61
61
|
@until = date
|
62
|
-
|
62
|
+
self
|
63
63
|
end
|
64
64
|
|
65
65
|
def between(sha1, sha2 = nil)
|
66
66
|
dirty_log
|
67
67
|
@between = [sha1, sha2]
|
68
|
-
|
68
|
+
self
|
69
69
|
end
|
70
70
|
|
71
71
|
def to_s
|
data/lib/git/status.rb
CHANGED
@@ -82,10 +82,12 @@ module Git
|
|
82
82
|
def construct_status
|
83
83
|
@files = @base.lib.ls_files
|
84
84
|
|
85
|
+
ignore = @base.lib.ignored_files
|
86
|
+
|
85
87
|
# find untracked in working dir
|
86
88
|
Dir.chdir(@base.dir.path) do
|
87
89
|
Dir.glob('**/*') do |file|
|
88
|
-
@files[file] = {:path => file, :untracked => true} unless @files[file] || File.directory?(file)
|
90
|
+
@files[file] = {:path => file, :untracked => true} unless @files[file] || File.directory?(file) || ignore.include?(file)
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minad-git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Chacon
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-04-08 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,7 +39,7 @@ files:
|
|
39
39
|
- lib/git.rb
|
40
40
|
- README
|
41
41
|
has_rdoc: true
|
42
|
-
homepage:
|
42
|
+
homepage: http://github.com/schacon/ruby-git/tree/master
|
43
43
|
post_install_message:
|
44
44
|
rdoc_options: []
|
45
45
|
|