Skip to content

Commit 22f93c8

Browse files
committed
Remove the chdir feature of #command
This argument was not used, so no functional change.
1 parent 66f4f77 commit 22f93c8

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
@@ -411,7 +411,7 @@ def ls_files(location=nil)
411411
def ls_remote(location=nil)
412412
location ||= '.'
413413
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|
415415
(sha, info) = line.split("\t")
416416
(ref, type, name) = info.split('/', 3)
417417
type ||= 'head'
@@ -450,7 +450,7 @@ def config_get(name)
450450
end
451451

452452
def global_config_get(name)
453-
command('config', ['--global', '--get', name], chdir: false)
453+
command('config', ['--global', '--get', name])
454454
end
455455

456456
def config_list
@@ -466,7 +466,7 @@ def config_list
466466
end
467467

468468
def global_config_list
469-
parse_config_list command_lines('config', ['--global', '--list'], chdir: false)
469+
parse_config_list command_lines('config', ['--global', '--list'])
470470
end
471471

472472
def parse_config_list(lines)
@@ -479,7 +479,7 @@ def parse_config_list(lines)
479479
end
480480

481481
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])
483483
end
484484

485485
# Shows objects
@@ -502,7 +502,7 @@ def config_set(name, value)
502502
end
503503

504504
def global_config_set(name, value)
505-
command('config', ['--global', name, value], chdir: false)
505+
command('config', ['--global', name, value])
506506
end
507507

508508
# updates the repository index using the working directory content
@@ -671,10 +671,10 @@ def unmerged
671671
def conflicts # :yields: file, your, their
672672
self.unmerged.each do |f|
673673
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}")
675675

676676
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}")
678678
yield(f, your, their)
679679
end
680680
end
@@ -799,7 +799,7 @@ def commit_tree(tree, opts = {})
799799
arr_opts << tree
800800
arr_opts << '-p' << opts[:parent] if opts[:parent]
801801
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}")
803803
end
804804

805805
def update_ref(branch, commit)
@@ -845,13 +845,13 @@ def archive(sha, file = nil, opts = {})
845845
arr_opts << "--remote=#{opts[:remote]}" if opts[:remote]
846846
arr_opts << sha
847847
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}")
849849
return file
850850
end
851851

852852
# returns the current version of git, as an Array of Fixnums.
853853
def current_command_version
854-
output = command('version', [], chdir: false)
854+
output = command('version', [])
855855
version = output[/\d+\.\d+(\.\d+)+/]
856856
version.split('.').collect {|i| i.to_i}
857857
end
@@ -923,15 +923,15 @@ def with_custom_env_variables(&block)
923923
end
924924

925925
def command(cmd, *opts, &block)
926-
command_opts = { chdir: true, redirect: '' }
926+
command_opts = { redirect: '' }
927927
if opts.last.is_a?(Hash)
928928
command_opts.merge!(opts.pop)
929929
end
930930
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)
932932
end
933933

934-
default_command_opts = { chdir: true, redirect: '' }
934+
default_command_opts = { redirect: '' }
935935
command_opts = default_command_opts.merge(command_opts)
936936

937937
global_opts = []

0 commit comments

Comments
 (0)