diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-27 14:33:44 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-27 14:33:44 -0400 |
commit | 563484e1354878df4a6877e4506af0d70e41b13e (patch) | |
tree | 119b65ec7fa76f1f6a72c25739f48bce1a58c146 /Core.hs | |
parent | 3281a1cb19e25f964ca9b91877a194fcb216ca5d (diff) |
pre-commit hook
Diffstat (limited to 'Core.hs')
-rw-r--r-- | Core.hs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -73,6 +73,21 @@ gitAttributes repo = do Git.run repo ["commit", "-m", "git-annex setup", attributes] +{- set up a git pre-commit hook, if one is not already present -} +gitPreCommitHook :: Git.Repo -> IO () +gitPreCommitHook repo = do + let hook = (Git.workTree repo) ++ "/" ++ (Git.dir repo) ++ + "/hooks/pre-commit" + exists <- doesFileExist hook + if (exists) + then putStrLn $ "pre-commit hook (" ++ hook ++ ") already exists, not configuring" + else do + writeFile hook $ "#!/bin/sh\n" ++ + "# automatically configured by git-annex\n" ++ + "git annex pre-commit .\n" + p <- getPermissions hook + setPermissions hook $ p {executable = True} + {- Checks if a given key is currently present in the annexLocation. - - This can be run against a remote repository to check the key there. -} |