aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint/post-merge.git-hook
blob: 475a10f59077ad5a46beefb273f32145ae33c941 (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
#!/bin/sh

git_toplevel=$(git rev-parse --show-toplevel)

check_for_diffs() {
        installed="$git_toplevel/.git/hooks/$1"
        latest="$git_toplevel/scripts/maint/$1.git-hook"

        if [ -e "$installed" ]
        then
               if ! cmp "$installed" "$latest" >/dev/null 2>&1
               then
                        echo "ATTENTION: $1 hook has changed:"
                        echo "==============================="
                        diff "$installed" "$latest"
               fi
        fi
}

check_for_script_update() {
        fullpath="$git_toplevel/scripts/maint/$1"

        git diff ORIG_HEAD HEAD --exit-code -- "$fullpath"
}

check_for_diffs "pre-push"
check_for_diffs "pre-commit"
check_for_diffs "post-merge"

check_for_script_update "git-merge-forward.sh"
check_for_script_update "git-pull-all.sh"
check_for_script_update "git-push-all.sh"