[LEDE-DEV] [PATCH 1/4] scripts/getver.sh: fail when an invalid commit reference is given
Matthias Schiffer
mschiffer at universe-factory.net
Sun Jul 9 17:19:48 PDT 2017
Correctly return "unknown" instead of printing various error messages,
followed by a "r0-..." revision.
Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
scripts/getver.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/scripts/getver.sh b/scripts/getver.sh
index 9175f411db..1032fa324e 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -24,6 +24,8 @@ try_git() {
REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))"
;;
*)
+ git rev-parse "$GET_REV^{commit}" >/dev/null 2>&1 || return 1
+
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)"
[ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)"
--
2.13.2
More information about the Lede-dev
mailing list