Skip to content

Commit 5df99be

Browse files
Mikulas Patockamasahir0y
authored andcommitted
scripts/setlocalversion: fix a bug when LOCALVERSION is empty
The commit 042da42 ("scripts/setlocalversion: simplify the short version part") reduces indentation. Unfortunately, it also changes behavior in a subtle way - if the user has empty "LOCALVERSION" variable, the plus sign is appended to the kernel version. It wasn't appended before. This patch reverts to the old behavior - we append the plus sign only if the LOCALVERSION variable is not set. Fixes: 042da42 ("scripts/setlocalversion: simplify the short version part") Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent e73f0f0 commit 5df99be

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/setlocalversion

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,14 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
131131
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
132132
# full scm version string
133133
res="$res$(scm_version)"
134-
elif [ -z "${LOCALVERSION}" ]; then
135-
# append a plus sign if the repository is not in a clean
136-
# annotated or signed tagged state (as git describe only
137-
# looks at signed or annotated tags - git tag -a/-s) and
138-
# LOCALVERSION= is not specified
134+
elif [ "${LOCALVERSION+set}" != "set" ]; then
135+
# If the variable LOCALVERSION is not set, append a plus
136+
# sign if the repository is not in a clean annotated or
137+
# signed tagged state (as git describe only looks at signed
138+
# or annotated tags - git tag -a/-s).
139+
#
140+
# If the variable LOCALVERSION is set (including being set
141+
# to an empty string), we don't want to append a plus sign.
139142
scm=$(scm_version --short)
140143
res="$res${scm:++}"
141144
fi

0 commit comments

Comments
 (0)