From 26565bb729549152ce8fa89f59df02f37c907c27 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 7 May 2019 10:01:16 +0200 Subject: Simplify git checkout, allow branches and commits Replace the following statements: a) "git checkout -f -B $BRANCH origin/$BRANCH" b) "git checkout -f -B $BRANCH $BRANCH" with: c) "git checkout -f $BRANCH" Regarding a), we don't need to specify 'origin/' for each branch, since we are cloning the repositories in the same Dockerfile, and therefore we know for sure that there is only one remote and branch names won't be ambiguous. Removing the 'origin/' allows to put commit hashes into the branch variables (like done in the new bisect script [1]). Version b) does not work with branch names: $ git checkout -f -B osmith/check-imei-before-lu osmith/check-imei-before-lu fatal: Cannot update paths and switch to branch 'osmith/check-imei-before-lu' at the same time. Did you intend to checkout 'osmith/check-imei-before-lu' which can not be resolved as commit? New version c) works with both commits and branches, and it is shorter. [1] Change-Id: I11f7e61a9b30d58a0fdfcaf77dde447806bf661f Change-Id: I2ff745c8d19b777d876170d5717c082ceb68a1f3 --- osmo-pcu-master/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'osmo-pcu-master/Dockerfile') diff --git a/osmo-pcu-master/Dockerfile b/osmo-pcu-master/Dockerfile index 7a294a4..fba8c31 100644 --- a/osmo-pcu-master/Dockerfile +++ b/osmo-pcu-master/Dockerfile @@ -28,7 +28,7 @@ RUN git clone git://git.osmocom.org/osmo-pcu.git 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 -f $OSMO_PCU_BRANCH && \ git rev-parse --abbrev-ref HEAD && git rev-parse HEAD && \ autoreconf -fi && \ ./configure --enable-trx && \ -- cgit v1.2.3