/usr/share/gitit-0.10.0.1/plugins/Signature.hs is in gitit 0.10.0.1-1+b1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | module Signature (plugin) where
-- This plugin replaces $SIG$ with the username and timestamp
-- of the last edit, prior to saving the page in the repository.
import Network.Gitit.Interface
import Data.DateTime (getCurrentTime, formatDateTime)
plugin :: Plugin
plugin = PreCommitTransform replacedate
replacedate :: String -> PluginM String
replacedate [] = return ""
replacedate ('$':'S':'I':'G':'$':xs) = do
datetime <- liftIO getCurrentTime
mbuser <- askUser
let username = case mbuser of
Nothing -> "???"
Just u -> uUsername u
let sig = concat ["-- ", username, " (", formatDateTime "%c" datetime, ")"]
fmap (sig ++ ) $ replacedate xs
replacedate (x:xs) = fmap (x : ) $ replacedate xs
|