[LEDE-DEV] [PATCH 3/4] scripts/getver.sh: include branch name in revision string
Matthias Schiffer
mschiffer at universe-factory.net
Sun Jul 9 17:19:50 PDT 2017
To determine the originating branch of a commit, a file called "branch"
must be added to the root of the repository (similar to the existing
"version" file used to override the getver.sh logic). When no such file
exists in the commit in question, the master branch is assumed.
Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
scripts/getver.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/getver.sh b/scripts/getver.sh
index 215bb036a5..f6d18bb3a3 100755
--- a/scripts/getver.sh
+++ b/scripts/getver.sh
@@ -5,6 +5,10 @@ export LC_ALL=C
GET_REV=$1
+get_branch() {
+ git show "$1:branch" 2>/dev/null || echo 'master'
+}
+
try_version() {
[ -f version ] || return 1
REV="$(cat version)"
@@ -42,7 +46,7 @@ try_git() {
REV="${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
fi
- REV="${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
+ REV="$(get_branch "$GET_REV")-${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
;;
esac
--
2.13.2
More information about the Lede-dev
mailing list