1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-10-18 05:18:14 +02:00

scripts: fix revision calculation using new "main" branch

Fix revision calculation when local branch is rebased on new "main" branch
instead of "master".

Signed-off-by: Marius Dinu <m95d+git@psihoexpert.ro>
Link: https://github.com/openwrt/openwrt/pull/15538
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Marius Dinu 2024-05-21 18:08:33 +03:00 committed by Christian Marangi
parent cd9241db23
commit 9db53fb6aa
No known key found for this signature in database
GPG Key ID: AC001D09ADBFEAD7

@ -26,7 +26,7 @@ try_git() {
*) *)
BRANCH="$(git rev-parse --abbrev-ref HEAD)" BRANCH="$(git rev-parse --abbrev-ref HEAD)"
ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)" 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)" [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name main@{u} 2>/dev/null)"
REV="$(git rev-list ${REBOOT}..$GET_REV 2>/dev/null | wc -l | awk '{print $1}')" REV="$(git rev-list ${REBOOT}..$GET_REV 2>/dev/null | wc -l | awk '{print $1}')"
if [ -n "$ORIGIN" ]; then if [ -n "$ORIGIN" ]; then