|
12 | 12 | # Sets GIT_TAG to the most recent signed tag (this will fall back to the |
13 | 13 | # most recent tag of any kind if no signed tag is found). |
14 | 14 | # |
| 15 | +# shellcheck shell=bash |
15 | 16 |
|
16 | 17 |
|
17 | 18 | function githelper() { |
@@ -45,46 +46,53 @@ function githelper() { |
45 | 46 | ;; |
46 | 47 | *) |
47 | 48 | GIT_TAG_GLOB="*" |
| 49 | + # Disable unused variable warnings on DEB_COMPONENT |
| 50 | + # shellcheck disable=SC2034 |
48 | 51 | DEB_COMPONENT="scratch" |
49 | 52 | ;; |
50 | 53 | esac |
51 | 54 |
|
52 | 55 |
|
53 | 56 | # use the gnupg keyring from our git repo to verify signatures on the release tags |
54 | | - export GNUPGHOME=$(git rev-parse --show-toplevel)/gnupg |
| 57 | + GNUPGHOME=$(git rev-parse --show-toplevel)/gnupg |
| 58 | + export GNUPGHOME |
55 | 59 |
|
56 | 60 | NEWEST_SIGNED_TAG_UTIME=-1 |
57 | 61 | NEWEST_UNSIGNED_TAG_UTIME=-1 |
58 | 62 | for TAG in $(git tag -l "$GIT_TAG_GLOB"); do |
59 | | - if ! git cat-file tag $TAG > /dev/null 2> /dev/null; then |
| 63 | + if ! git cat-file tag "$TAG" > /dev/null 2> /dev/null; then |
60 | 64 | continue |
61 | 65 | fi |
62 | 66 |
|
63 | | - TAG_UTIME=$(git cat-file tag $TAG | grep tagger | awk '{print $(NF-1)-$NF*36}') |
| 67 | + TAG_UTIME=$(git cat-file tag "$TAG" | grep tagger | awk '{print $(NF-1)-$NF*36}') |
64 | 68 |
|
65 | 69 | if git tag -v "$TAG" > /dev/null 2> /dev/null; then |
66 | 70 | # it's a valid signed tag |
67 | | - if [ $TAG_UTIME -gt $NEWEST_SIGNED_TAG_UTIME ]; then |
| 71 | + if [ "$TAG_UTIME" -gt "$NEWEST_SIGNED_TAG_UTIME" ]; then |
68 | 72 | NEWEST_SIGNED_TAG=$TAG |
69 | 73 | NEWEST_SIGNED_TAG_UTIME=$TAG_UTIME |
70 | 74 | fi |
71 | 75 | else |
72 | 76 | # unsigned tag |
73 | | - if [ $TAG_UTIME -gt $NEWEST_UNSIGNED_TAG_UTIME ]; then |
| 77 | + if [ "$TAG_UTIME" -gt "$NEWEST_UNSIGNED_TAG_UTIME" ]; then |
74 | 78 | NEWEST_UNSIGNED_TAG=$TAG |
75 | 79 | NEWEST_UNSIGNED_TAG_UTIME=$TAG_UTIME |
76 | 80 | fi |
77 | 81 | fi |
78 | 82 |
|
79 | 83 | done |
80 | 84 |
|
81 | | - if [ $NEWEST_SIGNED_TAG_UTIME -gt -1 ]; then |
| 85 | + if [ "$NEWEST_SIGNED_TAG_UTIME" -gt -1 ]; then |
| 86 | + # Disable unused variable warnings on GIT_TAG |
| 87 | + # shellcheck disable=SC2034 |
82 | 88 | GIT_TAG="$NEWEST_SIGNED_TAG" |
83 | 89 | return |
84 | 90 | fi |
85 | 91 |
|
86 | | - if [ $NEWEST_UNSIGNED_TAG_UTIME -gt -1 ]; then |
| 92 | + if [ "$NEWEST_UNSIGNED_TAG_UTIME" -gt -1 ]; then |
87 | 93 | echo "no signed tags found, falling back to unsigned tags" > /dev/null 1>&2 |
| 94 | + # Disable unused variable warnings on GIT_TAG |
| 95 | + # shellcheck disable=SC2034 |
88 | 96 | GIT_TAG="$NEWEST_UNSIGNED_TAG" |
89 | 97 | return |
90 | 98 | fi |
|
0 commit comments