scripts/setlocalversion: fix a bug when LOCALVERSION is empty

The commit 042da426f8eb ("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: 042da426f8eb ("scripts/setlocalversion: simplify the short version part")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Mikulas Patocka and committed by
Masahiro Yamada
5df99bec e73f0f0e

+8 -5
+8 -5
scripts/setlocalversion
··· 131 131 if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then 132 132 # full scm version string 133 133 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. 139 142 scm=$(scm_version --short) 140 143 res="$res${scm:++}" 141 144 fi