File: pre-commit

package info (click to toggle)
pgrouting 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,676 kB
  • sloc: cpp: 21,494; sql: 14,113; ansic: 9,896; perl: 1,144; sh: 848; javascript: 314; xml: 182; makefile: 29
file content (44 lines) | stat: -rwxr-xr-x 1,353 bytes parent folder | download | duplicates (4)
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
#!/bin/bash
# ------------------------------------------------------------------------------
# Git Tweaks
# Copyright(c) pgRouting Contributors
#
# About:
# ------
# This script writes the current Git version into the VERSION file
# To trigger this together with every commit, run
#
#	cp tools/pre-commit .git/hooks/pre-commit
#
# Note:
# -----
# The VERSION file is always one commit behind HEAD
# ------------------------------------------------------------------------------

if [[ $BRANCH == "gh-pages" ]]
then
    exit 0
fi

NOTES=`git diff HEAD --name-only doc/src/release_notes.rst`
NOTES2NEWS=`git diff HEAD --name-only tools/release-scripts/notes2news.pl`
NEWS=`git diff HEAD --name-only NEWS`

if [[ "b$NOTES" == "bdoc/src/release_notes.rst" || "b$NOTES2NEWS" == "btools/release-scripts/notes2news.pl" || "b$NEWS" == "NEWS" ]]
then
    echo "CHANGED: 'doc/src/release_notes.rst' or 'tools/release-scripts/notes2news.pl' or 'NEWS'"
    echo "Regenerating NEWS"
    $GIT_DIR/../tools/release-scripts/notes2news.pl
    git add $GIT_DIR/../doc/src/release_notes.rst
    git add $GIT_DIR/../tools/release-scripts/notes2news.pl
    git add $GIT_DIR/../NEWS
fi



COMMITS=`git rev-list HEAD --count`
HASH=`git rev-parse --short HEAD`
BRANCH="release/3.0"
#BRANCH="master"
echo $COMMITS-$HASH $BRANCH > $GIT_DIR/../VERSION
git add $GIT_DIR/../VERSION