scripts/setlocalversion: fix a bug when LOCALVERSION is empty
[linux-2.6-microblaze.git] / scripts / setlocalversion
index 151f049..6b54e46 100755 (executable)
@@ -131,11 +131,14 @@ res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
 if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
        # full scm version string
        res="$res$(scm_version)"
-elif [ -z "${LOCALVERSION}" ]; then
-       # append a plus sign if the repository is not in a clean
-       # annotated or signed tagged state (as git describe only
-       # looks at signed or annotated tags - git tag -a/-s) and
-       # LOCALVERSION= is not specified
+elif [ "${LOCALVERSION+set}" != "set" ]; then
+       # If the variable LOCALVERSION is not set, append a plus
+       # sign if the repository is not in a clean annotated or
+       # signed tagged state (as git describe only looks at signed
+       # or annotated tags - git tag -a/-s).
+       #
+       # If the variable LOCALVERSION is set (including being set
+       # to an empty string), we don't want to append a plus sign.
        scm=$(scm_version --short)
        res="$res${scm:++}"
 fi