File: getbuildnum.sh

package info (click to toggle)
pgmodeler 1.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,276 kB
  • sloc: cpp: 99,283; xml: 27; sh: 15; makefile: 6
file content (21 lines) | stat: -rwxr-xr-x 331 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

commit=""
date=`date '+%Y%m%d'`
IFS=':'

for dir in $PATH; do
    if [ -x $dir/git ]; then
        commit=`git rev-parse HEAD 2> /dev/null`
        
        if [ $? != 0 ]; then
            commit="";
        else
            commit=`echo "$commit" | cut -c1-9`
        fi

        break
    fi
done

echo "${commit}"