6cb86ebbf1
In Darcs, any command can have a post hook (and a pre hook), and the hook command can be set using a command-line option to the darcs command that you run. So, in the Vervis SSH server, if we add a --posthook option when running `darcs apply` to apply remotely received patches, we get a chance to process the patch data much like in the git post-receive hook. The setup this patch creates is similar to the git one: It writes a _darcs/prefs/defaults file to all Darcs repos, and that defaults file sets the posthook line for `darcs apply`. The posthook line simply executes the actual hook program written in Haskell. The current hook program is a one-liner that prints a line to stdout, so every time you `darcs push` you can tell the hook got executed. The next step is to implement the actual hook logic, by reading patch data from the environment variable in which Darcs puts it.
19 lines
583 B
Haskell
19 lines
583 B
Haskell
{- This file is part of Vervis.
|
|
-
|
|
- Written in 2019 by fr33domlover <fr33domlover@riseup.net>.
|
|
-
|
|
- ♡ Copying is an act of love. Please copy, reuse and share.
|
|
-
|
|
- The author(s) have dedicated all copyright and related and neighboring
|
|
- rights to this software to the public domain worldwide. This software is
|
|
- distributed without any warranty.
|
|
-
|
|
- You should have received a copy of the CC0 Public Domain Dedication along
|
|
- with this software. If not, see
|
|
- <http://creativecommons.org/publicdomain/zero/1.0/>.
|
|
-}
|
|
|
|
import Vervis.Hook
|
|
|
|
main :: IO ()
|
|
main = postReceive
|