scripts/getver.sh: prevent asking for negative rev-parse
authorChristian Marangi <ansuelsmth@gmail.com>
Sun, 12 Nov 2023 15:15:07 +0000 (16:15 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Sun, 12 Nov 2023 15:19:04 +0000 (16:19 +0100)
commit9e49e0a6c4535d345084cc62c594be5cad23b911
tree7abfd73c8c167a5309220aa911b984727c8b491a
parent10b130161d19ac839c6fae55bb376ac91d1ea211
scripts/getver.sh: prevent asking for negative rev-parse

With the case of asking an invalid version that is too big, getver.sh
might return an invalid output in the form of HEAD~-2260475641.

This is caused by BASE_REV - GET_REV using a negative number.

Prevent this by checking if BASE_REV - GET_REV actually return 0 or a
positive number and set REV variable accordingly. With the following
change, invalid revision number will result in unknown printed instead
of the invalid HEAD~-NUMBERS output.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
scripts/getver.sh