mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
setlocalversion: add -e option
Set the -e option to ensure this script fails on any unexpected errors. Without this change, the kernel build may continue running with an incorrect string in include/config/kernel.release. Currently, try_tag() returns 1 when the expected tag is not found as an ancestor, but this is a case where the script should continue. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
523f3dbc18
commit
e2ff1219a5
@ -10,6 +10,8 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "Usage: $0 [--no-local] [srctree]" >&2
|
echo "Usage: $0 [--no-local] [srctree]" >&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -34,7 +36,9 @@ try_tag() {
|
|||||||
tag="$1"
|
tag="$1"
|
||||||
|
|
||||||
# Is $tag an annotated tag?
|
# Is $tag an annotated tag?
|
||||||
[ "$(git cat-file -t "$tag" 2> /dev/null)" = tag ] || return 1
|
if [ "$(git cat-file -t "$tag" 2> /dev/null)" != tag ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
# Is it an ancestor of HEAD, and if so, how many commits are in $tag..HEAD?
|
# Is it an ancestor of HEAD, and if so, how many commits are in $tag..HEAD?
|
||||||
# shellcheck disable=SC2046 # word splitting is the point here
|
# shellcheck disable=SC2046 # word splitting is the point here
|
||||||
@ -43,12 +47,12 @@ try_tag() {
|
|||||||
# $1 is 0 if and only if $tag is an ancestor of HEAD. Use
|
# $1 is 0 if and only if $tag is an ancestor of HEAD. Use
|
||||||
# string comparison, because $1 is empty if the 'git rev-list'
|
# string comparison, because $1 is empty if the 'git rev-list'
|
||||||
# command somehow failed.
|
# command somehow failed.
|
||||||
[ "$1" = 0 ] || return 1
|
if [ "$1" != 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
# $2 is the number of commits in the range $tag..HEAD, possibly 0.
|
# $2 is the number of commits in the range $tag..HEAD, possibly 0.
|
||||||
count="$2"
|
count="$2"
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
scm_version()
|
scm_version()
|
||||||
|
Loading…
Reference in New Issue
Block a user