1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-11 18:23:58 +00:00

update version checker

This commit is contained in:
deadc0de6
2020-11-28 22:14:01 +01:00
parent 9ed28ca1fb
commit 831b3ddc1a

View File

@@ -23,7 +23,7 @@ get_current()
# get current tag # get current tag
get_current_tag() get_current_tag()
{ {
git describe --tags 2>/dev/null git describe --tags --long 2>/dev/null
} }
get_current_branch() get_current_branch()
@@ -52,10 +52,16 @@ get_branches()
need_update() need_update()
{ {
git fetch origin >/dev/null 2>&1 git fetch origin >/dev/null 2>&1
last=$(get_latest)
cur=$(get_current_tag) cur=$(get_current_tag)
if [ "${cur}" != "" ]; then # get short tag if on a lightweight tag
last=$(get_latest) echo "you are on ${cur}"
[ "${last}" != "${cur}" ] && echo "new version available: ${last}" && return tag=$(echo "$cur" | sed 's/\(v.*\)-.-.*$/\1/g')
#nb=$(echo "$cur" | sed 's/v.*-\(.\)-.*$/\1/g')
#commit=$(echo "$cur" | sed 's/v.*-.-\(.*\)$/\1/g')
# compare
if [ "${tag}" != "${last}" ]; then
echo "new version available: ${last}" && return
fi fi
changes=$(git status -s) changes=$(git status -s)
[ "${changes}" != "" ] && echo "new updates available" && return [ "${changes}" != "" ] && echo "new updates available" && return