summaryrefslogtreecommitdiffstats
path: root/README
blob: 8eea2de90dbcb86f310fb552451ab22924ffbc53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!-- -*- mode: markdown; -*- -->

# gitblag

`gitblag` is a simple hook script to automatically send an email to an
mailing list whenever a new entry/essay/post is pushed to a
website/blog maintained using [git][git], the stupid content tracker.

The subject and the body of the email is slurped from the commit
message.

`gitblag` is based on the `post-receive-email` script found in the
contrib/hooks directory in the [Git SCM][git]'s source.

[git]: http://git-scm.com/

See 'Using gitblag' for info on how to install and use it.

## Etymology

The name `gitblag` resulted from copulative compounding of two
obvious word stems -- `git` & `blag`.

The word `blag`, a mispronunciation of `blog`, AFAIK, (first) appeared
in the [xkcd comic][blag].

[blag]: http://xkcd.com/148/

## License

`gitblag` is licensed under the GNU General Public License version 3
or later. See COPYING for the full text of the license.

## Using gitblag

`gitblag` is meant to be used as a post-receive hook on a bare remote
git repository of a website/blog. This hook is invoked on the remote
repository when a `git push` happens on the local repository.

The `gitblag` script does two things:

+  Sends an email to a mailing list when it finds a specifically
   formatted `commit` (See 'Commit Message Format' section), on the
   *master* branch.

+  Checks out the latest version of the working tree.

For help setting up a website/blog maintained using git, read [Using
Git to manage a web site][git-website].

[git-website]: http://toroid.org/ams/git-website-howto

### Installation

Get a copy.

	$ git clone http://rsiddharth.ninth.su/git/gitblag.git 

Copy the script to the bare git repo of the website/blog.

	$ cd /path/to/your/bare/repo/wobsite.git

	$ cp /path/to/gitblag/src/gitblag.sh hooks/post-receive

    $ chmod 755 hooks/post-receive

Specify the location of the git maintained website/blog by changing
the value of `GIT_WORK_TREE` variable in the `hooks/post-receive`
script.

### Configuration

Go to the bare git repo of the website/blog.

    $ cd /path/to/your/bare/repo/wobsite.git

Set up the mailing list to which the script should send emails to.

	$ git config --local --add hooks.mailinglist yourblag@list.tld

Set up the email prefix. All emails will have their subjects prefixed
with this prefix, "[Mailing List Prefix]" if emailprefix is not set.

	$ git config --local --add hooks.emailprefix "[ BLAG PREFIX ]"

Set up the mailing list footer. Edit the `description` file in the
bare git repo.

	$ editor description

To set a custom `From` field, the hooks.envelopesender option needs to
be set.

    $ git config --local --add hooks.envelopesender from@address.tld

### Commit Message Format

+ Start the commit message with `[NEW POST]` followed by text that
will be used as the subject of the email.

+ Leave a blank line.

+ Write the body of the email.

See the `sample-commit-msg.txt` file.

## Contact

 rsiddharth `<rsiddharth@ninthfloor.org>`