A couple spelling tweaks; tweak order.
[rsync.git] / mkgitver
blob0102b0894e5f550f6b1e295cc1d1fd6e63322f35
1 #!/bin/sh
3 srcdir=`dirname $0`
5 if [ ! -f git-version.h ]; then
6 touch git-version.h
7 fi
9 if test -d "$srcdir/.git" || test -f "$srcdir/.git"; then
10 gitver=`git describe --abbrev=8 2>/dev/null`
11 # NOTE: I'm avoiding "|" in sed since I'm not sure if sed -r is portable and "\|" fails on some OSes.
12 verchk=`echo "$gitver-" | sed -n '/^v3\.[0-9][0-9]*\.[0-9][0-9]*\(pre[0-9]*\)*-/p'`
13 if [ -n "$verchk" ]; then
14 echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
15 if ! diff git-version.h.new git-version.h >/dev/null; then
16 echo "Updating git-version.h"
17 mv git-version.h.new git-version.h
18 else
19 rm git-version.h.new