@@ -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
@@ -414,7 +414,7 @@ def ls_files(location=nil)
414
414
def ls_remote ( location = nil )
415
415
location ||= '.'
416
416
Hash . new { |h , k | h [ k ] = { } } . tap do |hsh |
417
- command_lines ( 'ls-remote' , [ location ] , chdir : false ) . each do |line |
417
+ command_lines ( 'ls-remote' , [ location ] ) . each do |line |
418
418
( sha , info ) = line . split ( "\t " )
419
419
( ref , type , name ) = info . split ( '/' , 3 )
420
420
type ||= 'head'
@@ -453,7 +453,7 @@ def config_get(name)
453
453
end
454
454
455
455
def global_config_get ( name )
456
- command ( 'config' , [ '--global' , '--get' , name ] , chdir : false )
456
+ command ( 'config' , [ '--global' , '--get' , name ] )
457
457
end
458
458
459
459
def config_list
@@ -469,7 +469,7 @@ def config_list
469
469
end
470
470
471
471
def global_config_list
472
- parse_config_list command_lines ( 'config' , [ '--global' , '--list' ] , chdir : false )
472
+ parse_config_list command_lines ( 'config' , [ '--global' , '--list' ] )
473
473
end
474
474
475
475
def parse_config_list ( lines )
@@ -482,7 +482,7 @@ def parse_config_list(lines)
482
482
end
483
483
484
484
def parse_config ( file )
485
- parse_config_list command_lines ( 'config' , [ '--list' , '--file' , file ] , chdir : false )
485
+ parse_config_list command_lines ( 'config' , [ '--list' , '--file' , file ] )
486
486
end
487
487
488
488
# Shows objects
@@ -505,7 +505,7 @@ def config_set(name, value)
505
505
end
506
506
507
507
def global_config_set ( name , value )
508
- command ( 'config' , [ '--global' , name , value ] , chdir : false )
508
+ command ( 'config' , [ '--global' , name , value ] )
509
509
end
510
510
511
511
# updates the repository index using the working directory content
@@ -677,10 +677,10 @@ def unmerged
677
677
def conflicts # :yields: file, your, their
678
678
self . unmerged . each do |f |
679
679
your = Tempfile . new ( "YOUR-#{ File . basename ( f ) } " ) . path
680
- command ( 'show' , ":2:#{ f } " , chdir : true , redirect : "> #{ escape your } " )
680
+ command ( 'show' , ":2:#{ f } " , redirect : "> #{ escape your } " )
681
681
682
682
their = Tempfile . new ( "THEIR-#{ File . basename ( f ) } " ) . path
683
- command ( 'show' , ":3:#{ f } " , chdir : true , redirect : "> #{ escape their } " )
683
+ command ( 'show' , ":3:#{ f } " , redirect : "> #{ escape their } " )
684
684
yield ( f , your , their )
685
685
end
686
686
end
@@ -810,7 +810,7 @@ def commit_tree(tree, opts = {})
810
810
arr_opts << tree
811
811
arr_opts << '-p' << opts [ :parent ] if opts [ :parent ]
812
812
arr_opts += [ opts [ :parents ] ] . map { |p | [ '-p' , p ] } . flatten if opts [ :parents ]
813
- command ( 'commit-tree' , arr_opts , chdir : true , redirect : "< #{ escape t . path } " )
813
+ command ( 'commit-tree' , arr_opts , redirect : "< #{ escape t . path } " )
814
814
end
815
815
816
816
def update_ref ( branch , commit )
@@ -856,13 +856,13 @@ def archive(sha, file = nil, opts = {})
856
856
arr_opts << "--remote=#{ opts [ :remote ] } " if opts [ :remote ]
857
857
arr_opts << sha
858
858
arr_opts << '--' << opts [ :path ] if opts [ :path ]
859
- command ( 'archive' , arr_opts , chdir : true , redirect : ( opts [ :add_gzip ] ? '| gzip' : '' ) + " > #{ escape file } " )
859
+ command ( 'archive' , arr_opts , redirect : ( opts [ :add_gzip ] ? '| gzip' : '' ) + " > #{ escape file } " )
860
860
return file
861
861
end
862
862
863
863
# returns the current version of git, as an Array of Fixnums.
864
864
def current_command_version
865
- output = command ( 'version' , [ ] , chdir : false )
865
+ output = command ( 'version' , [ ] )
866
866
version = output [ /\d +\. \d +(\. \d +)+/ ]
867
867
version . split ( '.' ) . collect { |i | i . to_i }
868
868
end
@@ -934,15 +934,15 @@ def with_custom_env_variables(&block)
934
934
end
935
935
936
936
def command ( cmd , *opts , &block )
937
- command_opts = { chdir : true , redirect : '' }
937
+ command_opts = { redirect : '' }
938
938
if opts . last . is_a? ( Hash )
939
939
command_opts . merge! ( opts . pop )
940
940
end
941
941
command_opts . keys . each do |k |
942
- raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless [ :chdir , : redirect] . include? ( k )
942
+ raise ArgumentError . new ( "Unsupported option: #{ k } " ) unless [ :redirect ] . include? ( k )
943
943
end
944
944
945
- default_command_opts = { chdir : true , redirect : '' }
945
+ default_command_opts = { redirect : '' }
946
946
command_opts = default_command_opts . merge ( command_opts )
947
947
948
948
global_opts = [ ]
0 commit comments