Skip to content

Commit 30f9869

Browse files
committed
Use secure option with FileUtils.rm_rf
1 parent 7a42231 commit 30f9869

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/overcommit/installer.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def install_master_hook
100100
end
101101

102102
def uninstall_master_hook
103-
FileUtils.rm_rf(master_hook_install_path)
103+
FileUtils.rm_rf(master_hook_install_path, secure: true)
104104
end
105105

106106
def install_hook_symlinks
@@ -162,7 +162,7 @@ def uninstall_hook_symlinks
162162

163163
Dir.chdir(hooks_path) do
164164
Overcommit::Utils.supported_hook_types.each do |hook_type|
165-
FileUtils.rm_rf(hook_type) if overcommit_hook?(hook_type)
165+
FileUtils.rm_rf(hook_type, secure: true) if overcommit_hook?(hook_type)
166166
end
167167
end
168168
end

spec/overcommit/utils_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
context 'when there is no .git directory' do
2828
before do
29-
FileUtils.rm_rf('.git')
29+
FileUtils.rm_rf('.git', secure: true)
3030
end
3131

3232
it 'raises an exception' do
@@ -53,7 +53,7 @@
5353

5454
context 'when .git is a file' do
5555
before do
56-
FileUtils.rm_rf('.git')
56+
FileUtils.rm_rf('.git', secure: true)
5757
echo("gitdir: #{git_dir_path}", '.git')
5858
end
5959

0 commit comments

Comments
 (0)