setlocalversion (523f3dbc187a9618d4fd80c2b438e4d490705dcd) setlocalversion (e2ff1219a5541a22921016219c4d86a6d0190d15)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# This scripts adds local version information from the version
5# control system git.
6#
7# If something goes wrong, send a mail the kernel build mailinglist
8# (see MAINTAINERS) and CC Nico Schottelius
9# <nico-linuxsetlocalversion -at- schottelius.org>.
10#
11#
12
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# This scripts adds local version information from the version
5# control system git.
6#
7# If something goes wrong, send a mail the kernel build mailinglist
8# (see MAINTAINERS) and CC Nico Schottelius
9# <nico-linuxsetlocalversion -at- schottelius.org>.
10#
11#
12
13set -e
14
13usage() {
14 echo "Usage: $0 [--no-local] [srctree]" >&2
15 exit 1
16}
17
18no_local=false
19if test "$1" = "--no-local"; then
20 no_local=true

--- 8 unchanged lines hidden (view full) ---

29if test $# -gt 0 -o ! -d "$srctree"; then
30 usage
31fi
32
33try_tag() {
34 tag="$1"
35
36 # Is $tag an annotated tag?
15usage() {
16 echo "Usage: $0 [--no-local] [srctree]" >&2
17 exit 1
18}
19
20no_local=false
21if test "$1" = "--no-local"; then
22 no_local=true

--- 8 unchanged lines hidden (view full) ---

31if test $# -gt 0 -o ! -d "$srctree"; then
32 usage
33fi
34
35try_tag() {
36 tag="$1"
37
38 # Is $tag an annotated tag?
37 [ "$(git cat-file -t "$tag" 2> /dev/null)" = tag ] || return 1
39 if [ "$(git cat-file -t "$tag" 2> /dev/null)" != tag ]; then
40 return
41 fi
38
39 # Is it an ancestor of HEAD, and if so, how many commits are in $tag..HEAD?
40 # shellcheck disable=SC2046 # word splitting is the point here
41 set -- $(git rev-list --count --left-right "$tag"...HEAD 2> /dev/null)
42
43 # $1 is 0 if and only if $tag is an ancestor of HEAD. Use
44 # string comparison, because $1 is empty if the 'git rev-list'
45 # command somehow failed.
42
43 # Is it an ancestor of HEAD, and if so, how many commits are in $tag..HEAD?
44 # shellcheck disable=SC2046 # word splitting is the point here
45 set -- $(git rev-list --count --left-right "$tag"...HEAD 2> /dev/null)
46
47 # $1 is 0 if and only if $tag is an ancestor of HEAD. Use
48 # string comparison, because $1 is empty if the 'git rev-list'
49 # command somehow failed.
46 [ "$1" = 0 ] || return 1
50 if [ "$1" != 0 ]; then
51 return
52 fi
47
48 # $2 is the number of commits in the range $tag..HEAD, possibly 0.
49 count="$2"
53
54 # $2 is the number of commits in the range $tag..HEAD, possibly 0.
55 count="$2"
50
51 return 0
52}
53
54scm_version()
55{
56 local short=false
57 local no_dirty=false
58 local tag
59

--- 149 unchanged lines hidden ---
56}
57
58scm_version()
59{
60 local short=false
61 local no_dirty=false
62 local tag
63

--- 149 unchanged lines hidden ---