I know it's only an example, but having this might save someone else the
trouble of writing an enhanced version for themselves.
It basically does the same job as the old update hook, but with these
differences:
* The recipients list is read from the repository config file from
hooks.mailinglist
* Updating unannotated tags can be allowed by setting
hooks.allowunannotated
* Announcement emails (via annotated tag creation) can be sent to a
different mailing list by setting hooks.announcelist
* Output email is more verbose and generates specific content depending
on whether the ref is a tag, an annotated tag, a branch, or a
tracking branch
* The email is easier to filter; the subject line is prefixed with
[SCM] and a project description pulled from the "description" file
* It catches (and displays differently) branch updates that are
performed with a --force
Obviously, it's nothing that clever - it's the update hook I use on my
repositories but I've tried to keep it general, and tried to make the
output always relevant to the type of update.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
I got bitten because in the UK (where one would expect 1970-01-01 00:00
to be UTC 0) some politicians decided to mess around with daylight
savings time from 1968 to 1971; it was permanently BST (+0100). That
means that on my computer the following is true:
$ date --date="1970-01-01 00:00" +"%F %T %z (%Z)"
1970-01-01 00:00:00 +0100 (BST)
This of course means that the --date argument to date is specified in
local time, not UTC. So when the hooks--update script does this:
date=$(date --date="1970-01-01 00:00:00 $ts seconds")
It's actually saying (in my timezone) "1970-01-01 01:00:00 UTC" + $ts.
Clearly this is wrong. The UNIX epoch started at midnight UTC not 1am
UTC.
This leads to the tagged time in hooks--update being shown as one hour
earlier than the true tagged time (in my timezone). The problem would
be worse for other timezones. For a +1300 timezone on 1970-01-01, the
tagged time would be 13 hours earlier. Oops.
The solution is to force the reference time to UTC, which is what this
patch does. In my timezone:
$ date --date="1970-01-01 00:00 +0000" +"%F %T %z (%Z)"
1970-01-01 01:00:00 +0100 (BST)
Much better.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Otherwise, sending the diagnostic to stdout would provoke a
protocol failure.
Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Instead of showing all the history since the beginning of time
leading to the the branch head, show only the changes this new
branch brings to the world.
This originally came from Linus and tested by Andreas Ericsson.
Signed-off-by: Junio C Hamano <junkio@cox.net>
This is the update hook we use in all our git-repos.
It has some improvements over the original version, namely:
* Don't send every commit since dawn of time when adding a new tag.
* When updating an annotated tag, just send the diffs since the last tag.
* Add diffstat output for 'normal' commits (top) and annotated tags (bottom).
* Block un-annotated tags in shared repos.
I'm a bit uncertain about that last one, but it demonstrates how to
disallow updates of a ref which we use, so I kept it.
Note that git-describe is needed for the "changes since last annotated tag"
thing to work.
Signed-off-by: Andreas Ericsson <ae@op5.se>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Make the example address RFC2606 (aka BCP0032) compliant. Also
fix a couple of shell script errors.
Noted and fixed by Matthew Wilcox and Andreas Ericsson.
Signed-off-by: Junio C Hamano <junkio@cox.net>
On NetBSD 3 we trigger an error:
[: ==: unexpected operator
Double-equal is accepted by bash built-in '[' and bash(1) suggests
using '=' for strict POSIX compliance (test(1) from coreutils does not
mention '=='). Eradicate their uses everywhere.
[jc: Somebody with a pseudonym kindly sent a message to let
me know about the problem privately; I do not have access to a NetBSD
box.]
Signed-off-by: Junio C Hamano <junkio@cox.net>
Add sample code to distinguish --force rebased head and simple
fast-forward. At the same time fixes a real bug; the "new ref"
path was using a wrong parameter.
Signed-off-by: Junio C Hamano <junkio@cox.net>
A template mechanism to populate newly initialized repository
with default set of files is introduced. Use it to ship example
hooks that can be used for update and post update checks, as
Josef Weidendorfer suggests.
Signed-off-by: Junio C Hamano <junkio@cox.net>