diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-14 23:00:23 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-14 23:00:23 -0400 |
commit | bc5c54c987f548505a3877e8a0e460abe0b2a081 (patch) | |
tree | 4074e799eef10edb2060abf9d1ba2863c47b256c /Command | |
parent | 96e074bb0333b6952fb9fbce2f0a810ebafd3d2c (diff) |
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.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 7 | ||||
-rw-r--r-- | Command/Find.hs | 1 | ||||
-rw-r--r-- | Command/PreCommit.hs | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 26e7fa258..09fff7cff 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -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 diff --git a/Command/Find.hs b/Command/Find.hs index 1ca6ff1e7..3ed15c153 100644 --- a/Command/Find.hs +++ b/Command/Find.hs @@ -12,7 +12,6 @@ import Control.Monad.State (liftIO) import Command import Content -import Messages command :: [Command] command = [Command "find" (paramOptional $ paramRepeating paramPath) seek diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs index 6f9adb79a..1465ebc61 100644 --- a/Command/PreCommit.hs +++ b/Command/PreCommit.hs @@ -14,7 +14,6 @@ import qualified Annex import qualified GitRepo as Git import qualified Command.Add import qualified Command.Fix -import Messages import Utility command :: [Command] |