Skip to content

Commit a182ad3

Browse files
Nico Schotteliussravnborg
authored andcommitted
kbuild: fix scripts/setlocalversion with git
When using trees like wireless-testing, which have untagged tags, scripts/setlocalversion does not display any git indication for localversion. This patch fixes it: If git is available, but no usable tag is found, it uses -g${head}. It skips the detection of unanottated tags via git name-rev. Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
1 parent 99e3a1e commit a182ad3

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎scripts/setlocalversion‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ cd "${1:-.}" || usage
1010

1111
# Check for git and a git repo.
1212
if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
13-
# Do we have an untagged version?
14-
if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
15-
if tag=`git describe 2>/dev/null`; then
16-
echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
17-
else
18-
printf '%s%s' -g $head
19-
fi
13+
# Do we have an untagged tag?
14+
if atag=`git describe 2>/dev/null`; then
15+
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
16+
# add -g${head}, if there is no usable tag
17+
else
18+
printf '%s%s' -g $head
2019
fi
2120

2221
# Is this git on svn?

0 commit comments

Comments
 (0)