[2/7] setlocalversion: simplify the construction of the short version

Message ID 20230122141428.115372-2-masahiroy@kernel.org
State New
Headers
Series [1/7] kbuild: do not put .scmversion into the source tarball |

Commit Message

Masahiro Yamada Jan. 22, 2023, 2:14 p.m. UTC
  With the --short option given, scm_version() prints "+".
Just append it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/setlocalversion | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Nicolas Schier Jan. 29, 2023, 9:30 p.m. UTC | #1
On Sun 22 Jan 2023 23:14:22 GMT, Masahiro Yamada wrote:
> With the --short option given, scm_version() prints "+".
> Just append it.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/setlocalversion | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/scripts/setlocalversion b/scripts/setlocalversion
> index 3b31702b4a4a..5cdf409204aa 100755
> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -121,8 +121,7 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then
>  	#
>  	# 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:++}"
> +	res="$res$(scm_version --short)"
>  fi
>  
>  echo "$res"
> -- 
> 2.34.1

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
  

Patch

diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index 3b31702b4a4a..5cdf409204aa 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -121,8 +121,7 @@  elif [ "${LOCALVERSION+set}" != "set" ]; then
 	#
 	# 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:++}"
+	res="$res$(scm_version --short)"
 fi
 
 echo "$res"