Skip to content
Snippets Groups Projects
Commit b8aa57b5 authored by Wolfgang Denk's avatar Wolfgang Denk
Browse files

tools/setlocalversion: use a git-describe-ish format


Change the automatic local version to have the form -nnnnn-gSHA1SUMID,
where 'nnnnn' is the number of commits since the last tag (i.e.,
1.3.2-rc3).  This makes it much easier to recognize "newer" versions
and to see how much has been changed since the referenced tag.

Stolen from Linux kernel's scripts/setlocalversio, see commit d882421f.

Signed-off-by: default avatarWolfgang Denk <wd@denx.de>
parent c6dc21c8
No related branches found
No related tags found
No related merge requests found
...@@ -11,12 +11,15 @@ cd "${1:-.}" || usage ...@@ -11,12 +11,15 @@ cd "${1:-.}" || usage
# Check for git and a git repo. # Check for git and a git repo.
if head=`git rev-parse --verify HEAD 2>/dev/null`; then if head=`git rev-parse --verify HEAD 2>/dev/null`; then
# Do we have an untagged version? # Do we have an untagged version?
if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then if git name-rev --tags HEAD | \
printf '%s%s' -g `echo "$head" | cut -c1-8` grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
fi fi
# Are there uncommitted changes? # Are there uncommitted changes?
if git diff-files | read dummy; then git update-index --refresh --unmerged > /dev/null
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
| read dummy; then
printf '%s' -dirty printf '%s' -dirty
fi fi
fi fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment