Skip to content

Commit 99c9ee4

Browse files
authored
Merge pull request #566 from KoenDierckx/main
Only remove safe_directory, if it exists
2 parents bcae373 + c380b02 commit 99c9ee4

File tree

1 file changed

+4
-2
lines changed
  • lib/puppet/provider/vcsrepo

1 file changed

+4
-2
lines changed

lib/puppet/provider/vcsrepo/git.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def create
4242
end
4343

4444
def destroy
45-
remove_safe_directory if safe_directories.include?(@resource.value(:path))
45+
remove_safe_directory
4646
FileUtils.rm_rf(@resource.value(:path))
4747
end
4848

@@ -167,7 +167,7 @@ def update_remote_url(remote_name, remote_url)
167167
git_with_identity('remote', 'add', remote_name, remote_url)
168168
true
169169

170-
# If remote exists, but URL doesn't match, update URL
170+
# If remote exists, but URL doesn't match, update URL
171171
elsif !current.include? "remote.#{remote_name}.url=#{remote_url}"
172172
git_with_identity('remote', 'set-url', remote_name, remote_url)
173173
true
@@ -642,6 +642,8 @@ def add_safe_directory
642642

643643
# @!visibility private
644644
def remove_safe_directory
645+
return unless safe_directories.include?(@resource.value(:path))
646+
645647
notice("Removing '#{@resource.value(:path)}' from safe directory list")
646648
args = ['config', '--global', '--unset', 'safe.directory', @resource.value(:path)]
647649
git_with_identity(*args)

0 commit comments

Comments
 (0)