Jean-Nicolas Artaud schrieb:
>     * BUG/CCMAIL
>     * email/CIA

These are only notifications, but you can use the post-update hook only if
reflogs are enabled on the server (I do not know whether this is the case
on gitorious) because you have to find out the old value of the updated
branch (that would be branchn...@{1}).

>     * license header checks 

Strictly speaking, this is a verification, and should actually be a
pre-commit hook that prevents that wrong headers enter the repository in
the first place. But you cannot force users to enable the hook...

> Another thing is *necessary* for me is to have an example of a post-update 
> hook script because I cannot imagine what parameters are necessary for this.

It would go like this:

---- 8< ------
#!/bin/sh

treat_ref()
{
   old...@{1}   # this assumes that reflogs are available!
   new=$1
   for cmt in $(git rev-list $old..$new); do
      # investigate commit message
      git cat-file commit $cmt |
      while read line; do
         case $line in
         CCMAIL:*)
             ...
             ;;
         BUG:*)
             ...
             ;;
         esac
      done
      # investigate added files (but skip merges)
      git rev-parse --verify --quiet $cmt^2 -- ||
      git diff-tree --name-only --diff-filter=A -r $cmt^..$cmt -- |
      while read file; do
         # check license header
         git cat-file blob "$cmt:$file" | ...
      done
   done
}

for ref
do
    case $ref in
    refs/heads/*)
       treat_ref "$ref"
    esac
done
exit 0

---- 8< ------

-- Hannes
_______________________________________________
Kde-scm-interest mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-scm-interest

Reply via email to