Skip to content

Commit 78fd97e

Browse files
committed
Remove the chdir feature of #command
This argument was not used, so no functional change.
1 parent 03e4963 commit 78fd97e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/git/lib.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def init(opts={})
3737
arr_opts = []
3838
arr_opts << '--bare' if opts[:bare]
3939

40-
command('init', arr_opts, chdir: false)
40+
command('init', arr_opts)
4141
end
4242

4343
# tries to clone the given repo
@@ -132,7 +132,7 @@ def log_commits(opts={})
132132

133133
arr_opts += log_path_options(opts)
134134

135-
command_lines('log', arr_opts, chdir: true).map { |l| l.split.first }
135+
command_lines('log', arr_opts).map { |l| l.split.first }
136136
end
137137

138138
def full_log_commits(opts={})
@@ -143,7 +143,7 @@ def full_log_commits(opts={})
143143

144144
arr_opts += log_path_options(opts)
145145

146-
full_log = command_lines('log', arr_opts, chdir: true)
146+
full_log = command_lines('log', arr_opts)
147147

148148
process_commit_log_data(full_log)
149149
end
@@ -414,7 +414,7 @@ def ls_files(location=nil)
414414
def ls_remote(location=nil)
415415
location ||= '.'
416416
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|
418418
(sha, info) = line.split("\t")
419419
(ref, type, name) = info.split('/', 3)
420420
type ||= 'head'
@@ -453,7 +453,7 @@ def config_get(name)
453453
end
454454

455455
def global_config_get(name)
456-
command('config', ['--global', '--get', name], chdir: false)
456+
command('config', ['--global', '--get', name])
457457
end
458458

459459
def config_list
@@ -469,7 +469,7 @@ def config_list
469469
end
470470

471471
def global_config_list
472-
parse_config_list command_lines('config', ['--global', '--list'], chdir: false)
472+
parse_config_list command_lines('config', ['--global', '--list'])
473473
end
474474

475475
def parse_config_list(lines)
@@ -482,7 +482,7 @@ def parse_config_list(lines)
482482
end
483483

484484
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])
486486
end
487487

488488
# Shows objects
@@ -505,7 +505,7 @@ def config_set(name, value)
505505
end
506506

507507
def global_config_set(name, value)
508-
command('config', ['--global', name, value], chdir: false)
508+
command('config', ['--global', name, value])
509509
end
510510

511511
# updates the repository index using the working directory content
@@ -677,10 +677,10 @@ def unmerged
677677
def conflicts # :yields: file, your, their
678678
self.unmerged.each do |f|
679679
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}")
681681

682682
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}")
684684
yield(f, your, their)
685685
end
686686
end
@@ -810,7 +810,7 @@ def commit_tree(tree, opts = {})
810810
arr_opts << tree
811811
arr_opts << '-p' << opts[:parent] if opts[:parent]
812812
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}")
814814
end
815815

816816
def update_ref(branch, commit)
@@ -856,13 +856,13 @@ def archive(sha, file = nil, opts = {})
856856
arr_opts << "--remote=#{opts[:remote]}" if opts[:remote]
857857
arr_opts << sha
858858
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}")
860860
return file
861861
end
862862

863863
# returns the current version of git, as an Array of Fixnums.
864864
def current_command_version
865-
output = command('version', [], chdir: false)
865+
output = command('version', [])
866866
version = output[/\d+\.\d+(\.\d+)+/]
867867
version.split('.').collect {|i| i.to_i}
868868
end
@@ -934,15 +934,15 @@ def with_custom_env_variables(&block)
934934
end
935935

936936
def command(cmd, *opts, &block)
937-
command_opts = { chdir: true, redirect: '' }
937+
command_opts = { redirect: '' }
938938
if opts.last.is_a?(Hash)
939939
command_opts.merge!(opts.pop)
940940
end
941941
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)
943943
end
944944

945-
default_command_opts = { chdir: true, redirect: '' }
945+
default_command_opts = { redirect: '' }
946946
command_opts = default_command_opts.merge(command_opts)
947947

948948
global_opts = []

0 commit comments

Comments
 (0)