summaryrefslogtreecommitdiffstats
path: root/src/VREF/FILETYPE
blob: 3f1d5f9b689225152e058b995be510c783cc2688 (plain)
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
#!/bin/sh

# gitolite VREF to find autogenerated files

# *completely* site specific; use it as an illustration of what can be done
# with gitolite VREFs if you wish

# see gitolite docs for what the first 7 arguments mean

# inputs:
#   arg-8 is currently only one possible value: AUTOGENERATED
# outputs (STDOUT)
#   arg-7 if any files changed in the push look like they were autogenerated
#   otherwise nothing
# exit status:
#   always 0

die() { echo "$@" >&2; exit 1; }
[ -z "$8" ] && die "not meant to be run manually"

newsha=$3
oldtree=$4
newtree=$5
refex=$7

option=$8

[ "$option" = "AUTOGENERATED" ] && {
    # currently we only look for ".java" programs with the string "Generated
    # by the protocol buffer compiler.  DO NOT EDIT" in them.

    git log --name-only $nf --format=%n $newtree --not --all |
        grep . |
        sort -u |
        grep '\.java$' |
    while read fn
    do
        git show "$newtree:$fn" | egrep >/dev/null \
            'Generated by the protocol buffer compiler. +DO NOT EDIT' ||
            continue

        echo $refex
        exit 0
    done
}