diff options
Diffstat (limited to 'Remote/Helper/Git.hs')
-rw-r--r-- | Remote/Helper/Git.hs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Remote/Helper/Git.hs b/Remote/Helper/Git.hs index 156d7ac28..9ed27ac8b 100644 --- a/Remote/Helper/Git.hs +++ b/Remote/Helper/Git.hs @@ -10,6 +10,9 @@ module Remote.Helper.Git where import Common.Annex import qualified Git import Types.Availability +import qualified Types.Remote as Remote + +import Data.Time.Clock.POSIX repoCheap :: Git.Repo -> Bool repoCheap = not . Git.repoIsUrl @@ -31,7 +34,15 @@ guardUsable r fallback a | Git.repoIsLocalUnknown r = fallback | otherwise = a -gitRepoInfo :: Git.Repo -> [(String, String)] -gitRepoInfo r = - [ ("repository location", Git.repoLocation r) - ] +gitRepoInfo :: Remote -> Annex [(String, String)] +gitRepoInfo r = do + d <- fromRepo Git.localGitDir + mtimes <- liftIO $ mapM (modificationTime <$$> getFileStatus) + =<< dirContentsRecursive (d </> "refs" </> "remotes" </> Remote.name r) + let lastsynctime = case mtimes of + [] -> "never" + _ -> show $ posixSecondsToUTCTime $ realToFrac $ maximum mtimes + return + [ ("repository location", Git.repoLocation (Remote.repo r)) + , ("last synced", lastsynctime) + ] |