diff mbox series

[testsuite,3/4] travis: fix git/cache handling

Message ID 20200623123702.401338-4-omosnace@redhat.com (mailing list archive)
State Accepted
Headers show
Series Various CI-related testsuite fixes | expand

Commit Message

Ondrej Mosnacek June 23, 2020, 12:37 p.m. UTC
The current way of fetching new changes from git blows up when there has
been a force-push. Switch to just fetching and then checking out the
remote branch directly rather than using git pull.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 travis-ci/setup-policy-fedora.sh    | 10 ++++++----
 travis-ci/setup-policy-refpolicy.sh |  4 +++-
 2 files changed, 9 insertions(+), 5 deletions(-)

Comments

Stephen Smalley June 23, 2020, 1:15 p.m. UTC | #1
On Tue, Jun 23, 2020 at 8:37 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>
> The current way of fetching new changes from git blows up when there has
> been a force-push. Switch to just fetching and then checking out the
> remote branch directly rather than using git pull.
>
> Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>

Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
diff mbox series

Patch

diff --git a/travis-ci/setup-policy-fedora.sh b/travis-ci/setup-policy-fedora.sh
index d2793f0..bce8698 100644
--- a/travis-ci/setup-policy-fedora.sh
+++ b/travis-ci/setup-policy-fedora.sh
@@ -4,11 +4,12 @@  set -ex
 
 if ! [ -d selinux-policy/.git ]; then
 	git clone --recursive https://github.com/fedora-selinux/selinux-policy
-	(cd selinux-policy/policy/modules/contrib && git checkout rawhide)
 else
-	(cd selinux-policy && git pull || { git checkout '*' && git pull; })
-	(cd selinux-policy/policy/modules/contrib && git pull)
+	git -C selinux-policy fetch origin
+	git -C selinux-policy/policy/modules/contrib fetch origin
 fi
+git -C selinux-policy checkout origin/rawhide
+git -C selinux-policy/policy/modules/contrib checkout origin/rawhide
 
 if ! [ -d container-selinux/.git ]; then
 	git clone https://github.com/containers/container-selinux.git
@@ -17,8 +18,9 @@  if ! [ -d container-selinux/.git ]; then
 			selinux-policy/policy/modules/contrib/$f
 	done
 else
-	(cd container-selinux && git pull)
+	git -C container-selinux fetch origin
 fi
+git -C container-selinux checkout origin/master
 
 cd selinux-policy
 
diff --git a/travis-ci/setup-policy-refpolicy.sh b/travis-ci/setup-policy-refpolicy.sh
index abd4ca4..3010467 100644
--- a/travis-ci/setup-policy-refpolicy.sh
+++ b/travis-ci/setup-policy-refpolicy.sh
@@ -5,11 +5,13 @@  set -ex
 if ! [ -d refpolicy/.git ]; then
 	git clone https://github.com/SELinuxProject/refpolicy
 else
-	git pull || { git checkout '*' && git pull; }
+	git -C refpolicy fetch origin
 fi
 
 cd refpolicy
 
+git checkout origin/master
+
 [ -f policy/modules.conf ] || make conf
 
 make -j`nproc --all` BINDIR=/usr/local/bin SBINDIR=/usr/local/sbin