mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Refactor
* lib/fileutils.rb (FileUtils::Entry_#copy_metadata): eliminate common statements. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c4f809e93
commit
71db7bd3d3
1 changed files with 8 additions and 15 deletions
|
@ -1273,6 +1273,7 @@ module FileUtils
|
||||||
if !st.symlink?
|
if !st.symlink?
|
||||||
File.utime st.atime, st.mtime, path
|
File.utime st.atime, st.mtime, path
|
||||||
end
|
end
|
||||||
|
mode = st.mode
|
||||||
begin
|
begin
|
||||||
if st.symlink?
|
if st.symlink?
|
||||||
begin
|
begin
|
||||||
|
@ -1284,23 +1285,15 @@ module FileUtils
|
||||||
end
|
end
|
||||||
rescue Errno::EPERM
|
rescue Errno::EPERM
|
||||||
# clear setuid/setgid
|
# clear setuid/setgid
|
||||||
|
mode &= 01777
|
||||||
|
end
|
||||||
if st.symlink?
|
if st.symlink?
|
||||||
begin
|
begin
|
||||||
File.lchmod st.mode & 01777, path
|
File.lchmod mode, path
|
||||||
rescue NotImplementedError
|
rescue NotImplementedError
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
File.chmod st.mode & 01777, path
|
File.chmod mode, path
|
||||||
end
|
|
||||||
else
|
|
||||||
if st.symlink?
|
|
||||||
begin
|
|
||||||
File.lchmod st.mode, path
|
|
||||||
rescue NotImplementedError
|
|
||||||
end
|
|
||||||
else
|
|
||||||
File.chmod st.mode, path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue