copy icon indicating copy to clipboard operation
copy copied to clipboard

Support PreserveTimes for symlinks on Unix

Open fako1024 opened this issue 1 year ago • 3 comments

This is an addition to https://github.com/otiai10/copy/pull/31 - While symlink timestamps cannot be set universally (neither at time of link creation nor by a simple call to os.Chtimes()) they can be set on Unix making use of unix.Lutimes(). This PR extends the existing PreserveTime option by that, transferring the original link timestamp(s) to the newly created one if the option is set.

For unsupported architectures, a stub is provided similar to already existing ones (e.g. for ownership preservation).

fako1024 avatar Jul 16 '22 13:07 fako1024

Codecov Report

Merging #83 (55416e9) into main (be95711) will increase coverage by 1.43%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   77.40%   78.83%   +1.43%     
==========================================
  Files          13       15       +2     
  Lines         177      189      +12     
==========================================
+ Hits          137      149      +12     
  Misses         20       20              
  Partials       20       20              
Impacted Files Coverage Δ
copy.go 76.47% <100.00%> (+0.96%) :arrow_up:
preserve_ltimes.go 100.00% <100.00%> (ø)
preserve_ltimes_x.go 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov-commenter avatar Jul 23 '22 09:07 codecov-commenter

@otiai10 It seems that a recent upstream change breaks the GopherJS Pipeline (unrelated to this issue): https://github.com/gopherjs/gopherjs/commit/f754ef8bf776018e09b416319246ed4b72365832

What's your preference, should I open an independent issue for that? Do you want to fix it on main directly for a rebase?

fako1024 avatar Aug 10 '22 07:08 fako1024

Thank you, @fako1024

open an independent issue for that

This would be super cool! Thank you so much ;)

otiai10 avatar Aug 10 '22 07:08 otiai10

Thank you for everything!

otiai10 avatar Aug 13 '22 09:08 otiai10