Blame view
scripts/setlocalversion
527 Bytes
117a93db1
|
1 2 |
#!/bin/sh # Print additional version information for non-release trees. |
aaebf4332
|
3 |
|
117a93db1
|
4 5 6 |
usage() { echo "Usage: $0 [srctree]" >&2 exit 1 |
aaebf4332
|
7 |
} |
117a93db1
|
8 |
cd "${1:-.}" || usage |
aaebf4332
|
9 |
|
117a93db1
|
10 11 12 |
# Check for git and a git repo. if head=`git rev-parse --verify HEAD 2>/dev/null`; then # Do we have an untagged version? |
29b0c8995
|
13 |
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then |
117a93db1
|
14 15 |
printf '%s%s' -g `echo "$head" | cut -c1-8` fi |
aaebf4332
|
16 |
|
117a93db1
|
17 |
# Are there uncommitted changes? |
216b2f1f7
|
18 |
if git diff-index HEAD | read dummy; then |
24d49756a
|
19 |
printf '%s' -dirty |
117a93db1
|
20 21 |
fi fi |