Change in docker-playground[master]: Fix git checkout for branches and commits

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 22 12:32:26 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14128 )

Change subject: Fix git checkout for branches and commits
......................................................................

Fix git checkout for branches and commits

Replace 'git checkout -f -B $BRANCH origin/$BRANCH && \' in all
Dockerfiles that accept branch variables ($OSMO_TTCN3_BRANCH,
$OSMO_MGW_BRANCH, ...) with the following:
	git checkout $BRANCH && \
	(git symbolic-ref -q HEAD && git reset --hard origin/$BRANCH || exit 1); \

This allows using branch names and commit hashes in the $BRANCH
variables. Using commits is needed for the bisect script added in [1].

The second line ("(git symbolic...") checks if we are in detached HEAD
state after the checkout, and if we are not, pulls in all new commits
from origin/$BRANCH. Note that it ends in ';' instead of '&&', because
the command in the next line should be executed even if
"git symbolic-ref" does not exit with 0 (detached HEAD state).

Here is an example, to illustrate that the new command does the right
thing. Clone a repository and be 50 commits behind origin/master:
$ git clone "https://git.osmocom.org/osmo-mgw"
$ cd osmo-mgw
$ git reset --hard origin/master~50

With BRANCH="master":
$ git checkout master && \
  (git symbolic-ref -q HEAD && git reset --hard origin/master || exit 1); \
  echo "done"
Already on 'master'
...
done
$ git status
Your branch is up-to-date with 'origin/master'.

With BRANCH="85978d":
$ git checkout 85978d && \
  (git symbolic-ref -q HEAD && git reset --hard origin/85978d || exit 1); \
  echo "done"
Note: checking out '85978d'.
...
done
$ git status
HEAD detached at 85978dad

Related previous changes:
* [2] made it work for commit hashes, but broke using branch names other
      than master, and pulling in new commits from master
* [3] made branches other than master work again, but did not fix
      pulling in new commits from master
* [4] reverted [3] and the git checkout related part from [2]

[1] Change-Id: I11f7e61a9b30d58a0fdfcaf77dde447806bf661f
[2] Change-Id: If3bc5fae07cf63c4fef68306be4c4328660bc869
[3] Change-Id: I2ff745c8d19b777d876170d5717c082ceb68a1f3
[4] Change-Id: Ie6da0f9ea96f11407e38545a6b3cf22ef9cadc25

Related: OS#4015
Change-Id: I4004980baf0b7d6096702b6f3067ccbdb369a28c
---
M osmo-bsc-master/Dockerfile
M osmo-bts-master/Dockerfile
M osmo-ggsn-master/Dockerfile
M osmo-hlr-master/Dockerfile
M osmo-hnbgw-master/Dockerfile
M osmo-mgw-master/Dockerfile
M osmo-msc-master/Dockerfile
M osmo-nitb-master/Dockerfile
M osmo-pcu-master/Dockerfile
M osmo-sgsn-master/Dockerfile
M osmo-sip-master/Dockerfile
M osmo-stp-master/Dockerfile
M osmocom-bb-host-master/Dockerfile
M ttcn3-bsc-test/Dockerfile
M ttcn3-bscnat-test/Dockerfile
M ttcn3-bts-test/Dockerfile
M ttcn3-ggsn-test/Dockerfile
M ttcn3-hlr-test/Dockerfile
M ttcn3-mgw-test/Dockerfile
M ttcn3-msc-test/Dockerfile
M ttcn3-nitb-sysinfo/Dockerfile
M ttcn3-pcu-test/Dockerfile
M ttcn3-sgsn-test/Dockerfile
M ttcn3-sip-test/Dockerfile
24 files changed, 48 insertions(+), 24 deletions(-)

Approvals:
  osmith: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/osmo-bsc-master/Dockerfile b/osmo-bsc-master/Dockerfile
index bcd0573..cb80c4a 100644
--- a/osmo-bsc-master/Dockerfile
+++ b/osmo-bsc-master/Dockerfile
@@ -32,7 +32,8 @@
 ADD	http://git.osmocom.org/osmo-bsc/patch?h=$OSMO_BSC_BRANCH /tmp/commit-osmo-bsc
 
 RUN	cd osmo-bsc && \
-	git fetch && git checkout -f -B $OSMO_BSC_BRANCH $OSMO_BSC_BRANCH && \
+	git fetch && git checkout $OSMO_BSC_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_BSC_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmo-bts-master/Dockerfile b/osmo-bts-master/Dockerfile
index f4ddf3a..a7f1145 100644
--- a/osmo-bts-master/Dockerfile
+++ b/osmo-bts-master/Dockerfile
@@ -33,7 +33,8 @@
 ADD	http://git.osmocom.org/osmo-bts/patch?h=$OSMO_BTS_BRANCH /tmp/commit-osmo-bts
 
 RUN	cd osmo-bts && \
-	git fetch && git checkout -f -B $OSMO_BTS_BRANCH $OSMO_BTS_BRANCH && \
+	git fetch && git checkout $OSMO_BTS_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_BTS_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure --enable-trx && \
diff --git a/osmo-ggsn-master/Dockerfile b/osmo-ggsn-master/Dockerfile
index cf84d02..f27bef9 100644
--- a/osmo-ggsn-master/Dockerfile
+++ b/osmo-ggsn-master/Dockerfile
@@ -25,7 +25,8 @@
 RUN	git clone git://git.osmocom.org/osmo-ggsn.git
 ADD	http://git.osmocom.org/osmo-ggsn/patch/?h=$OSMO_GGSN_BRANCH /tmp/commit
 RUN	cd osmo-ggsn && \
-	git fetch && git checkout -f -B $OSMO_GGSN_BRANCH $OSMO_GGSN_BRANCH && \
+	git fetch && git checkout $OSMO_GGSN_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_GGSN_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmo-hlr-master/Dockerfile b/osmo-hlr-master/Dockerfile
index 2da7c08..e9f9398 100644
--- a/osmo-hlr-master/Dockerfile
+++ b/osmo-hlr-master/Dockerfile
@@ -30,7 +30,8 @@
 ADD	http://git.osmocom.org/osmo-hlr/patch?h=$OSMO_HLR_BRANCH /tmp/commit-osmo-hlr
 
 RUN	cd osmo-hlr && \
-	git fetch && git checkout -f -B $OSMO_HLR_BRANCH $OSMO_HLR_BRANCH && \
+	git fetch && git checkout $OSMO_HLR_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_HLR_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmo-hnbgw-master/Dockerfile b/osmo-hnbgw-master/Dockerfile
index c89502b..af5bc91 100644
--- a/osmo-hnbgw-master/Dockerfile
+++ b/osmo-hnbgw-master/Dockerfile
@@ -30,7 +30,8 @@
 ADD	http://git.osmocom.org/osmo-iuh/patch?h=$OSMO_IUH_BRANCH /tmp/commit-osmo-mgw
 
 RUN	cd osmo-iuh && \
-	git fetch && git checkout -f -B $OSMO_IUH_BRANCH $OSMO_IUH_BRANCH && \
+	git fetch && git checkout $OSMO_IUH_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_IUH_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmo-mgw-master/Dockerfile b/osmo-mgw-master/Dockerfile
index 4c6d32a..3df37c1 100644
--- a/osmo-mgw-master/Dockerfile
+++ b/osmo-mgw-master/Dockerfile
@@ -30,7 +30,8 @@
 
 
 RUN	cd osmo-mgw && \
-	git fetch && git checkout -f -B $OSMO_MGW_BRANCH $OSMO_MGW_BRANCH && \
+	git fetch && git checkout $OSMO_MGW_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_MGW_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmo-msc-master/Dockerfile b/osmo-msc-master/Dockerfile
index c8cfd62..21c7eda 100644
--- a/osmo-msc-master/Dockerfile
+++ b/osmo-msc-master/Dockerfile
@@ -37,7 +37,8 @@
 ADD	http://git.osmocom.org/osmo-msc/patch?h=$OSMO_MSC_BRANCH /tmp/commit-osmo-msc
 
 RUN	cd osmo-msc && \
-	git fetch && git checkout -f -B $OSMO_MSC_BRANCH $OSMO_MSC_BRANCH && \
+	git fetch && git checkout $OSMO_MSC_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_MSC_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure --enable-smpp --enable-iu && \
diff --git a/osmo-nitb-master/Dockerfile b/osmo-nitb-master/Dockerfile
index d3774da..c7fb008 100644
--- a/osmo-nitb-master/Dockerfile
+++ b/osmo-nitb-master/Dockerfile
@@ -31,7 +31,8 @@
 ADD	http://git.osmocom.org/openbsc/patch?h=$OSMO_NITB_BRANCH /tmp/commit-openbsc
 
 RUN	cd openbsc/openbsc && \
-	git fetch && git checkout -f -B $OSMO_NITB_BRANCH $OSMO_NITB_BRANCH && \
+	git fetch && git checkout $OSMO_NITB_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_NITB_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure --enable-nat --enable-osmo-bsc --enable-smpp && \
diff --git a/osmo-pcu-master/Dockerfile b/osmo-pcu-master/Dockerfile
index 7a294a4..01f7755 100644
--- a/osmo-pcu-master/Dockerfile
+++ b/osmo-pcu-master/Dockerfile
@@ -28,7 +28,8 @@
 ADD	http://git.osmocom.org/osmo-pcu/patch?h=$OSMO_PCU_BRANCH /tmp/commit-osmo-pcu
 
 RUN	cd osmo-pcu && \
-	git fetch && git checkout -f -B $OSMO_PCU_BRANCH $OSMO_PCU_BRANCH && \
+	git fetch && git checkout $OSMO_PCU_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_PCU_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure --enable-trx && \
diff --git a/osmo-sgsn-master/Dockerfile b/osmo-sgsn-master/Dockerfile
index c373564..4257141 100644
--- a/osmo-sgsn-master/Dockerfile
+++ b/osmo-sgsn-master/Dockerfile
@@ -32,7 +32,8 @@
 ADD	http://git.osmocom.org/osmo-sgsn/patch?h=$OSMO_SGSN_BRANCH /tmp/commit
 
 RUN	cd osmo-sgsn && \
-	git fetch && git checkout -f -B $OSMO_SGSN_BRANCH $OSMO_SGSN_BRANCH && \
+	git fetch && git checkout $OSMO_SGSN_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_SGSN_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmo-sip-master/Dockerfile b/osmo-sip-master/Dockerfile
index 258b1fe..4a9d49b 100644
--- a/osmo-sip-master/Dockerfile
+++ b/osmo-sip-master/Dockerfile
@@ -36,7 +36,8 @@
 ADD	http://git.osmocom.org/osmo-sip-connector/patch?h=$OSMO_SIP_BRANCH /tmp/commit-osmo-sip-connector
 
 RUN	cd osmo-sip-connector && \
-	git fetch && git checkout -f -B $OSMO_SIP_BRANCH $OSMO_SIP_BRANCH && \
+	git fetch && git checkout $OSMO_SIP_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_SIP_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure --enable-smpp --enable-iu && \
diff --git a/osmo-stp-master/Dockerfile b/osmo-stp-master/Dockerfile
index 0a62ed7..fa49085 100644
--- a/osmo-stp-master/Dockerfile
+++ b/osmo-stp-master/Dockerfile
@@ -26,7 +26,8 @@
 RUN	git clone git://git.osmocom.org/libosmo-sccp.git
 ADD	http://git.osmocom.org/libosmo-sccp/patch?h=$OSMO_STP_BRANCH /tmp/commit
 RUN	cd libosmo-sccp && \
-	git fetch && git checkout -f -B $OSMO_STP_BRANCH $OSMO_STP_BRANCH && \
+	git fetch && git checkout $OSMO_STP_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_STP_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	autoreconf -fi && \
 	./configure && \
diff --git a/osmocom-bb-host-master/Dockerfile b/osmocom-bb-host-master/Dockerfile
index 260f381..6ec0c9a 100644
--- a/osmocom-bb-host-master/Dockerfile
+++ b/osmocom-bb-host-master/Dockerfile
@@ -25,7 +25,8 @@
 
 ADD	http://git.osmocom.org/osmocom-bb/patch?h=$OSMO_BB_BRANCH /tmp/commit
 RUN	cd osmocom-bb && \
-	git fetch && git checkout -f -B $OSMO_BB_BRANCH origin/$OSMO_BB_BRANCH && \
+	git fetch && git checkout $OSMO_BB_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_BB_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD
 
 RUN	cd osmocom-bb/src/host/trxcon && \
diff --git a/ttcn3-bsc-test/Dockerfile b/ttcn3-bsc-test/Dockerfile
index 546f33b..9288469 100644
--- a/ttcn3-bsc-test/Dockerfile
+++ b/ttcn3-bsc-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make bsc
 
diff --git a/ttcn3-bscnat-test/Dockerfile b/ttcn3-bscnat-test/Dockerfile
index 047f21c..f927513 100644
--- a/ttcn3-bscnat-test/Dockerfile
+++ b/ttcn3-bscnat-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make bsc-nat
 
diff --git a/ttcn3-bts-test/Dockerfile b/ttcn3-bts-test/Dockerfile
index d8969bb..29185c8 100644
--- a/ttcn3-bts-test/Dockerfile
+++ b/ttcn3-bts-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make deps-update bts
 
diff --git a/ttcn3-ggsn-test/Dockerfile b/ttcn3-ggsn-test/Dockerfile
index 6d6aff6..7e88f28 100644
--- a/ttcn3-ggsn-test/Dockerfile
+++ b/ttcn3-ggsn-test/Dockerfile
@@ -12,7 +12,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make ggsn_tests
 
diff --git a/ttcn3-hlr-test/Dockerfile b/ttcn3-hlr-test/Dockerfile
index 752d442..0233035 100644
--- a/ttcn3-hlr-test/Dockerfile
+++ b/ttcn3-hlr-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make deps-update hlr
 
diff --git a/ttcn3-mgw-test/Dockerfile b/ttcn3-mgw-test/Dockerfile
index bf13d12..33183d0 100644
--- a/ttcn3-mgw-test/Dockerfile
+++ b/ttcn3-mgw-test/Dockerfile
@@ -13,7 +13,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make mgw
 
diff --git a/ttcn3-msc-test/Dockerfile b/ttcn3-msc-test/Dockerfile
index 53aa393..ee7e5f0 100644
--- a/ttcn3-msc-test/Dockerfile
+++ b/ttcn3-msc-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make msc
 
diff --git a/ttcn3-nitb-sysinfo/Dockerfile b/ttcn3-nitb-sysinfo/Dockerfile
index d0ec87a..76fd630 100644
--- a/ttcn3-nitb-sysinfo/Dockerfile
+++ b/ttcn3-nitb-sysinfo/Dockerfile
@@ -13,7 +13,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make sysinfo
 
diff --git a/ttcn3-pcu-test/Dockerfile b/ttcn3-pcu-test/Dockerfile
index fbb64f5..b78fee2 100644
--- a/ttcn3-pcu-test/Dockerfile
+++ b/ttcn3-pcu-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make pcu
 
diff --git a/ttcn3-sgsn-test/Dockerfile b/ttcn3-sgsn-test/Dockerfile
index 3049d3f..42a53f2 100644
--- a/ttcn3-sgsn-test/Dockerfile
+++ b/ttcn3-sgsn-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make sgsn
 
diff --git a/ttcn3-sip-test/Dockerfile b/ttcn3-sip-test/Dockerfile
index eead347..9f1a6df 100644
--- a/ttcn3-sip-test/Dockerfile
+++ b/ttcn3-sip-test/Dockerfile
@@ -16,7 +16,8 @@
 ADD	http://git.osmocom.org/osmo-ttcn3-hacks/patch?h=$OSMO_TTCN3_BRANCH /tmp/commit
 RUN	cd osmo-ttcn3-hacks && \
 	git fetch && \
-	git checkout -f -B $OSMO_TTCN3_BRANCH origin/$OSMO_TTCN3_BRANCH && \
+	git checkout $OSMO_TTCN3_BRANCH && \
+	(git symbolic-ref -q HEAD && git reset --hard origin/$OSMO_TTCN3_BRANCH || exit 1); \
 	git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \
 	make sip
 

-- 
To view, visit https://gerrit.osmocom.org/14128
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4004980baf0b7d6096702b6f3067ccbdb369a28c
Gerrit-Change-Number: 14128
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Daniel Willmann <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190522/b6c5b814/attachment.html>


More information about the gerrit-log mailing list