diff options
-rw-r--r-- | Command/Fix.hs | 20 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/__96__git_annex_add__96___changes_mtime_if_symlinks_are_fixed_in_the_background.mdwn | 2 |
3 files changed, 20 insertions, 3 deletions
diff --git a/Command/Fix.hs b/Command/Fix.hs index c6b4df257..da2627619 100644 --- a/Command/Fix.hs +++ b/Command/Fix.hs @@ -5,6 +5,8 @@ - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Command.Fix where import System.PosixCompat.Files @@ -12,6 +14,9 @@ import System.PosixCompat.Files import Common.Annex import Command import qualified Annex.Queue +#ifndef __ANDROID__ +import Utility.Touch +#endif def :: [Command] def = [notDirect $ noCommit $ command "fix" paramPaths seek @@ -30,9 +35,18 @@ start file (key, _) = do perform :: FilePath -> FilePath -> CommandPerform perform file link = do - liftIO $ createDirectoryIfMissing True (parentDir file) - liftIO $ removeFile file - liftIO $ createSymbolicLink link file + liftIO $ do +#ifndef __ANDROID__ + -- preserve mtime of symlink + mtime <- catchMaybeIO $ TimeSpec . modificationTime + <$> getSymbolicLinkStatus file +#endif + createDirectoryIfMissing True (parentDir file) + removeFile file + createSymbolicLink link file +#ifndef __ANDROID__ + maybe noop (\t -> touch file t False) mtime +#endif next $ cleanup file cleanup :: FilePath -> CommandCleanup diff --git a/debian/changelog b/debian/changelog index b68f650a8..141d4ee7b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,7 @@ git-annex (4.20130710) UNRELEASED; urgency=low * Install XDG desktop icon files. * webapp: Better display of added files. + * fix: Preserve the original mtime of fixed symlinks. -- Joey Hess <joeyh@debian.org> Tue, 09 Jul 2013 19:17:13 -0400 diff --git a/doc/bugs/__96__git_annex_add__96___changes_mtime_if_symlinks_are_fixed_in_the_background.mdwn b/doc/bugs/__96__git_annex_add__96___changes_mtime_if_symlinks_are_fixed_in_the_background.mdwn index abcaa27ff..eba11aa2d 100644 --- a/doc/bugs/__96__git_annex_add__96___changes_mtime_if_symlinks_are_fixed_in_the_background.mdwn +++ b/doc/bugs/__96__git_annex_add__96___changes_mtime_if_symlinks_are_fixed_in_the_background.mdwn @@ -47,3 +47,5 @@ git-annex 4.20130709 on Debian unstable i386 and x64. As noted in [[todo/wishlist:___96__git_annex_import__96___--_An_easy_way_to_get_data_into_an_annex/#comment-e0ea68b5f84cf4130001ad34e9f3b2ff]], `git annex import` does not seem to work on other repos which is why I tried to build this by hand. This works fine and retains mtime as long as I don't need to change the relative depth the symlinks. I think that the issue above should be fixed in and as of itself, though. + +> [[fixed|done]] --[[Joey]] |