From b63d7938dbf6f56d66e1ea526c47180b18284096 Mon Sep 17 00:00:00 2001
From: Emmanuel Raviart <emmanuel@raviart.com>
Date: Tue, 4 Jan 2022 15:27:40 +0100
Subject: [PATCH] Improve git repository reset.

---
 gitlab-ci/src/gitlab-ci.ts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gitlab-ci/src/gitlab-ci.ts b/gitlab-ci/src/gitlab-ci.ts
index f8f9afd4a..e6935db11 100644
--- a/gitlab-ci/src/gitlab-ci.ts
+++ b/gitlab-ci/src/gitlab-ci.ts
@@ -343,6 +343,7 @@ function objectFromVersion(
 
 async function resetGitRepository() {
   // Reset current repo, because it may have been tranformed by a previous CI that failed.
+  await $`git reset --hard`
   await $`git switch ${CI_COMMIT_BRANCH}`
   await $`git fetch origin ${CI_COMMIT_BRANCH}`
   await $`git reset --hard origin/${CI_COMMIT_BRANCH}`
-- 
GitLab