symlink touching fun

When adding files to the annex, the symlinks pointing at the annexed
content are made to have the same mtime as the original file. While git
does not preserve that information, this allows a tool like metastore to be
used with annexed files.
This commit is contained in:
Joey Hess 2011-03-14 23:00:23 -04:00
parent 96e074bb03
commit bc5c54c987
8 changed files with 101 additions and 4 deletions

View file

@ -18,6 +18,7 @@ import Types
import Content
import Messages
import Utility
import Touch
command :: [Command]
command = [Command "add" paramPath seek "add files to annex"]
@ -53,5 +54,11 @@ cleanup file key = do
link <- calcGitLink file key
liftIO $ createSymbolicLink link file
-- touch the symlink to have the same mtime as the file it points to
s <- liftIO $ getFileStatus file
let mtime = modificationTime s
_ <- liftIO $ touch file (TimeSpec mtime 0) False
Annex.queue "add" [Param "--"] file
return True