7 if [ -d .
/.git
] || git rev-parse
--is-inside-work-tree > /dev
/null
2> /dev
/null
9 REV
=$
(git show
--format=%H
#%ci -s $(git rev-parse HEAD) |
10 sed -e 's/ .*//' -e 's/[0-9a-f]\{30\}#/#/' -e 's/-//g' \
12 X
=$
(git status
-s -uno |
sed -e 's/.*/X/' |
uniq)
22 if [ -e "$srcdir"/include
/vgversion_dist.h
]
24 cp "$srcdir"/include
/vgversion_dist.h include
/vgversion.h.tmp
26 cat > include
/vgversion.h.tmp
<<EOF
27 /* Do not edit: file generated by auxprogs/make_or_upd_vgversion_h.
28 This file defines VGGIT, used to report GIT revision
29 when using command line options: -v --version
30 The produced VGGIT format is
32 where hhhhhhhhhh is the first 10 characters of the HEAD commit
33 YYYYMMDD is the commit date
34 Trailing X is present if there are any (non untracked) modified files.
36 #define VGGIT "$(extract_git_version .)"
40 if [ -f include
/vgversion.h
]
42 # There is already a vgversion.h.
43 # Update it only if we found a different and real git version
44 if grep -q unknown include
/vgversion.h.tmp ||
45 cmp -s include
/vgversion.h include
/vgversion.h.tmp
47 rm -f include
/vgversion.h.tmp
49 mv include
/vgversion.h.tmp include
/vgversion.h
52 # There is no vgversion.h. Use the one just generated, whatever it is.
53 mv include
/vgversion.h.tmp include
/vgversion.h