From 7828e5672d5be4b8d89946abb35c04267c785f61 Mon Sep 17 00:00:00 2001
From: Denis Pynkin <denis.pynkin@collabora.com>
Date: Fri, 26 Jul 2019 02:55:04 +0300
Subject: [PATCH] Update "common" subtree from correct branch

We do not use "master" anymore, hence try to autodetect the proper
branch and fallback to master otherwise.

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
---
 common-subtree.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/common-subtree.sh b/common-subtree.sh
index 59c5e21..b757ed6 100755
--- a/common-subtree.sh
+++ b/common-subtree.sh
@@ -7,12 +7,15 @@ usage () {
 	echo "'$0 pull' is used to update the common subtree in tests"
 }
 
+branch="$(git symbolic-ref --short HEAD)"
+test -z "$branch" && branch="master"
+
 case $1 in
 pull)
-git subtree pull -P common git@gitlab.apertis.org:tests/common.git master
+git subtree pull -P common git@gitlab.apertis.org:tests/common.git "$branch"
 ;;
 add)
-git subtree add -P common git@gitlab.apertis.org:tests/common.git master
+git subtree add -P common git@gitlab.apertis.org:tests/common.git "$branch"
 ;;
 *) usage;;
 esac
-- 
GitLab