From f17ca266b9bf0f75564ffde96d96d8404588f45f Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Fri, 21 Jun 2024 14:30:00 +0200 Subject: [PATCH] Fix ownership of local git repo used during tests Using the --shared feature of init --- .github/workflows/ci-docker.yml | 2 +- scripts/ci-github.sh | 13 ++++++++++--- src/alire/alire-version.ads | 2 +- testsuite/fixtures/crates/libfoo_git/HEAD | 2 +- testsuite/fixtures/crates/libfoo_git/config | 3 +++ .../07/2d593793eda4efbb0af13f3fa422d72f5492d3 | Bin 18 -> 0 bytes .../9a/6aa1471db1a0c821570db875b12f08653f623c | 1 - .../f4/fdb928df3b0be3f896b18be4987ce7338f0a54 | Bin 127 -> 0 bytes testsuite/fixtures/crates/libfoo_git/packed-refs | 2 -- .../crates/libfoo_git/refs/heads/.emptydir | 0 testsuite/fixtures/crates/libhello_git | 1 - 11 files changed, 16 insertions(+), 10 deletions(-) delete mode 100644 testsuite/fixtures/crates/libfoo_git/objects/07/2d593793eda4efbb0af13f3fa422d72f5492d3 delete mode 100644 testsuite/fixtures/crates/libfoo_git/objects/9a/6aa1471db1a0c821570db875b12f08653f623c delete mode 100644 testsuite/fixtures/crates/libfoo_git/objects/f4/fdb928df3b0be3f896b18be4987ce7338f0a54 delete mode 100644 testsuite/fixtures/crates/libfoo_git/packed-refs delete mode 100644 testsuite/fixtures/crates/libfoo_git/refs/heads/.emptydir delete mode 160000 testsuite/fixtures/crates/libhello_git diff --git a/.github/workflows/ci-docker.yml b/.github/workflows/ci-docker.yml index 6808694c8..a01ad2d05 100644 --- a/.github/workflows/ci-docker.yml +++ b/.github/workflows/ci-docker.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: submodules: true diff --git a/scripts/ci-github.sh b/scripts/ci-github.sh index a0a673c42..06800270e 100755 --- a/scripts/ci-github.sh +++ b/scripts/ci-github.sh @@ -13,10 +13,17 @@ pushd "$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" . ../dev/functions.sh popd -# Mark location safe to assuage git if necessary (happens in some distros) +# Mark location safe to assuage git if necessary (happens under docker as we +# run with a different user). if git status 2>&1 | grep -q "dubious ownership"; then - echo "Marking $PWD as safe for git" - git config --global --add safe.directory "$PWD" + echo "Marking $PWD as safe for git" + git config --global --add safe.directory "$PWD" + + # Change ownership and group to current user of everything in the testsuite, + # as we have there some pre-created git repositories that would fail too. + # These are copied to temporary locations by the test runner, so we cannot + # simply use the `git config` trick. + sudo chown -R $(id -u):$(id -g) testsuite fi # Patch version diff --git a/src/alire/alire-version.ads b/src/alire/alire-version.ads index 441a826dc..a515731a3 100644 --- a/src/alire/alire-version.ads +++ b/src/alire/alire-version.ads @@ -16,7 +16,7 @@ private -- be replaced by `alr build` with the current commit, and appended with -- "_or_later" after build. - Current_Str : constant String := "2.1-dev"; + Current_Str : constant String := "2.1-dev+367057b7"; -- 2.0.0: alr settings refactor and minor fixes -- 2.0.0-rc1: release candidate for 2.0 -- 2.0.0-b1: first public release on the 2.0 branch diff --git a/testsuite/fixtures/crates/libfoo_git/HEAD b/testsuite/fixtures/crates/libfoo_git/HEAD index cb089cd89..b870d8262 100644 --- a/testsuite/fixtures/crates/libfoo_git/HEAD +++ b/testsuite/fixtures/crates/libfoo_git/HEAD @@ -1 +1 @@ -ref: refs/heads/master +ref: refs/heads/main diff --git a/testsuite/fixtures/crates/libfoo_git/config b/testsuite/fixtures/crates/libfoo_git/config index 07d359d07..164a3ce26 100644 --- a/testsuite/fixtures/crates/libfoo_git/config +++ b/testsuite/fixtures/crates/libfoo_git/config @@ -2,3 +2,6 @@ repositoryformatversion = 0 filemode = true bare = true + sharedrepository = 2 +[receive] + denyNonFastforwards = true diff --git a/testsuite/fixtures/crates/libfoo_git/objects/07/2d593793eda4efbb0af13f3fa422d72f5492d3 b/testsuite/fixtures/crates/libfoo_git/objects/07/2d593793eda4efbb0af13f3fa422d72f5492d3 deleted file mode 100644 index eae9323f7044afd2a8f7476e1c645694655608bf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18 ZcmbV$TF_24NNEL;yc01-SqK diff --git a/testsuite/fixtures/crates/libfoo_git/objects/9a/6aa1471db1a0c821570db875b12f08653f623c b/testsuite/fixtures/crates/libfoo_git/objects/9a/6aa1471db1a0c821570db875b12f08653f623c deleted file mode 100644 index 30748e72a..000000000 --- a/testsuite/fixtures/crates/libfoo_git/objects/9a/6aa1471db1a0c821570db875b12f08653f623c +++ /dev/null @@ -1 +0,0 @@ -xͽ @ag& Z.Icttp DLŧ7vs 7G-EI{FfcPQQAlK{m?5c@Xsz`-L6t@S+uruBgEReFO$>lQ zA&KF1px^54uIoSTTq=6z$&p*D)`Y!X57n5=@NDj**_$q2bN24mTvr}-