Skip to content

Commit 8ecea93

Browse files
committed
shfmt
1 parent 2d6cee9 commit 8ecea93

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

scripts/version.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,28 @@ if [[ -n "${CODER_FORCE_VERSION:-}" ]]; then
2626
exit 0
2727
fi
2828

29-
3029
# To make contributing easier, if there are no tags, we'll use a default
3130
# version.
3231
tag_list=$(git tag)
3332
if [[ -z ${tag_list} ]]; then
34-
log
35-
log "INFO(version.sh): It appears you've checked out a fork or shallow clone of Coder."
36-
log "INFO(version.sh): By default GitHub does not include tags when forking."
37-
log "INFO(version.sh): We will use the default version 2.0.0 for this build."
38-
log "INFO(version.sh): To pull tags from upstream, use the following commands:"
39-
log "INFO(version.sh): - git remote add upstream https://github.com/coder/coder.git"
40-
log "INFO(version.sh): - git fetch upstream"
41-
log
42-
last_tag="v2.0.0"
33+
log
34+
log "INFO(version.sh): It appears you've checked out a fork or shallow clone of Coder."
35+
log "INFO(version.sh): By default GitHub does not include tags when forking."
36+
log "INFO(version.sh): We will use the default version 2.0.0 for this build."
37+
log "INFO(version.sh): To pull tags from upstream, use the following commands:"
38+
log "INFO(version.sh): - git remote add upstream https://github.com/coder/coder.git"
39+
log "INFO(version.sh): - git fetch upstream"
40+
log
41+
last_tag="v2.0.0"
4342
else
44-
current_commit=$(git rev-parse HEAD)
45-
# Try to find the last tag that contains the current commit
46-
last_tag=$(git tag --contains "$current_commit" --sort=version:refname | head -n 1)
47-
# If there is no tag that contains the current commit,
48-
# get the latest tag sorted by semver.
49-
if [[ -z "${last_tag}" ]]; then
50-
last_tag=$(git tag --sort=version:refname | tail -n 1)
51-
fi
43+
current_commit=$(git rev-parse HEAD)
44+
# Try to find the last tag that contains the current commit
45+
last_tag=$(git tag --contains "$current_commit" --sort=version:refname | head -n 1)
46+
# If there is no tag that contains the current commit,
47+
# get the latest tag sorted by semver.
48+
if [[ -z "${last_tag}" ]]; then
49+
last_tag=$(git tag --sort=version:refname | tail -n 1)
50+
fi
5251
fi
5352

5453
version="${last_tag}"

0 commit comments

Comments
 (0)