Skip to content

Commit e1b7398

Browse files
simonklbelastisys-staffan
authored andcommitted
tests: Fix git revision cloning
Since cloning with depth 1 only fetches the latest commit doing a reset on a commit that is not the latest broke the previous version.
1 parent 0be82e6 commit e1b7398

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/common/install-tools.bash

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,14 @@ _git_clone_revision() {
174174
local -r dest="${2}"
175175
local -r rev="${3}"
176176

177-
git clone -q --depth 1 "${repo}" "${dest}"
177+
# TODO: Start using this when Git v2.49 is available.
178+
# git clone -q --depth 1 --revision "${rev}" "${repo}" "${dest}"
179+
mkdir -p "${dest}"
178180
pushd "${dest}" >/dev/null
179-
git reset -q --hard "${rev}"
180-
git clean -q -fd
181+
git init
182+
git remote add origin "${repo}"
183+
git fetch --depth 1 origin "${rev}"
184+
git checkout FETCH_HEAD
181185
popd >/dev/null
182186
}
183187

0 commit comments

Comments
 (0)