@@ -37,7 +37,7 @@ def init(opts={})
37
37
arr_opts = [ ]
38
38
arr_opts << '--bare' if opts [ :bare ]
39
39
40
- command ( 'init' , arr_opts , chdir : false )
40
+ command ( 'init' , arr_opts )
41
41
end
42
42
43
43
# tries to clone the given repo
@@ -132,7 +132,7 @@ def log_commits(opts={})
132
132
133
133
arr_opts += log_path_options ( opts )
134
134
135
- command_lines ( 'log' , arr_opts , chdir : true ) . map { |l | l . split . first }
135
+ command_lines ( 'log' , arr_opts ) . map { |l | l . split . first }
136
136
end
137
137
138
138
def full_log_commits ( opts = { } )
@@ -143,7 +143,7 @@ def full_log_commits(opts={})
143
143
144
144
arr_opts += log_path_options ( opts )
145
145
146
- full_log = command_lines ( 'log' , arr_opts , chdir : true )
146
+ full_log = command_lines ( 'log' , arr_opts )
147
147
148
148
process_commit_log_data ( full_log )
149
149
end
@@ -411,7 +411,7 @@ def ls_files(location=nil)
411
411
def ls_remote ( location = nil )
412
412
location ||= '.'
413
413
Hash . new { |h , k | h [ k ] = { } } . tap do |hsh |
414
- command_lines ( 'ls-remote' , [ location ] , chdir : false ) . each do |line |
414
+ command_lines ( 'ls-remote' , [ location ] ) . each do |line |
415
415
( sha , info ) = line . split ( "\t " )
416
416
( ref , type , name ) = info . split ( '/' , 3 )
417
417
type ||= 'head'
@@ -450,7 +450,7 @@ def config_get(name)
450
450
end
451
451
452
452
def global_config_get ( name )
453
- command ( 'config' , [ '--global' , '--get' , name ] , chdir : false )
453
+ command ( 'config' , [ '--global' , '--get' , name ] )
454
454
end
455
455
456
456
def config_list
@@ -466,7 +466,7 @@ def config_list
466
466
end
467
467
468
468
def global_config_list
469
- parse_config_list command_lines ( 'config' , [ '--global' , '--list' ] , chdir : false )
469
+ parse_config_list command_lines ( 'config' , [ '--global' , '--list' ] )
470
470
end
471
471
472
472
def parse_config_list ( lines )
@@ -479,7 +479,7 @@ def parse_config_list(lines)
479
479
end
480
480
481
481
def parse_config ( file )
482
- parse_config_list command_lines ( 'config' , [ '--list' , '--file' , file ] , chdir : false )
482
+ parse_config_list command_lines ( 'config' , [ '--list' , '--file' , file ] )
483
483
end
484
484
485
485
# Shows objects
@@ -502,7 +502,7 @@ def config_set(name, value)
502
502
end
503
503
504
504
def global_config_set ( name , value )
505
- command ( 'config' , [ '--global' , name , value ] , chdir : false )
505
+ command ( 'config' , [ '--global' , name , value ] )
506
506
end
507
507
508
508
# updates the repository index using the working directory content
@@ -671,10 +671,10 @@ def unmerged
671
671
def conflicts # :yields: file, your, their
672
672
self . unmerged . each do |f |
673
673
your = Tempfile . new ( "YOUR-#{ File . basename ( f ) } " ) . path
674
- command ( 'show' , ":2:#{ f } " , chdir : true , redirect : "> #{ escape your } " )
674
+ command ( 'show' , ":2:#{ f } " , redirect : "> #{ escape your } " )
675
675
676
676
their = Tempfile . new ( "THEIR-#{ File . basename ( f ) } " ) . path
677
- command ( 'show' , ":3:#{ f } " , chdir : true , redirect : "> #{ escape their } " )
677
+ command ( 'show' , ":3:#{ f } " , redirect : "> #{ escape their } " )
678
678
yield ( f , your , their )
679
679
end
680
680
end
@@ -799,7 +799,7 @@ def commit_tree(tree, opts = {})
799
799
arr_opts << tree
800
800
arr_opts << '-p' << opts [ :parent ] if opts [ :parent ]
801
801
arr_opts += [ opts [ :parents ] ] . map { |p | [ '-p' , p ] } . flatten if opts [ :parents ]
802
- command ( 'commit-tree' , arr_opts , chdir : true , redirect : "< #{ escape t . path } " )
802
+ command ( 'commit-tree' , arr_opts , redirect : "< #{ escape t . path } " )
803
803
end
804
804
805
805
def update_ref ( branch , commit )
@@ -845,13 +845,13 @@ def archive(sha, file = nil, opts = {})
845
845
arr_opts << "--remote=#{ opts [ :remote ] } " if opts [ :remote ]
846
846
arr_opts << sha
847
847
arr_opts << '--' << opts [ :path ] if opts [ :path ]
848
- command ( 'archive' , arr_opts , chdir : true , redirect : ( opts [ :add_gzip ] ? '| gzip' : '' ) + " > #{ escape file } " )
848
+ command ( 'archive' , arr_opts , redirect : ( opts [ :add_gzip ] ? '| gzip' : '' ) + " > #{ escape file } " )
849
849
return file
850
850
end
851
851
852
852
# returns the current version of git, as an Array of Fixnums.
853
853
def current_command_version
854
- output = command ( 'version' , [ ] , chdir : false )
854
+ output = command ( 'version' , [ ] )
855
855
version = output [ /\d +\. \d +(\. \d +)+/ ]
856
856
version . split ( '.' ) . collect { |i | i . to_i }
857
857
end
@@ -923,15 +923,15 @@ def with_custom_env_variables(&block)
923
923
end
924
924
925
925
def command ( cmd , *opts , &block )
926
- command_opts = { chdir : true , redirect : '' }
926
+ command_opts = { redirect : '' }
927
927
if opts . last . is_a? ( Hash )
928
928
command_opts . merge! ( opts . pop )
929
929
end
930
930
command_opts . keys . each do |k |
931
- raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless %i[ chdir redirect ] . include? ( k )
931
+ raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless %i[ redirect ] . include? ( k )
932
932
end
933
933
934
- default_command_opts = { chdir : true , redirect : '' }
934
+ default_command_opts = { redirect : '' }
935
935
command_opts = default_command_opts . merge ( command_opts )
936
936
937
937
global_opts = [ ]
0 commit comments