Skip to content

Commit d07c32d

Browse files
committed
Fix gix-url baseline script instead of taking ownership
Taking ownership of cloned files in the container only fixed one failing test, `gix-url::baseline run`. This had been failing with a git `safe.directory` error in the the gix-url `make_baseline.sh` fixture script. That failure was also reproduced locally by recursively `chown`ing the cloned files to another user (while preserving write permissions for the first user via the group). Because the tests shouldn't unnecessarily depend on starting out in a repository (nor anything about the outer repository they start in), this should probably be considered a test bug that is not specific to the current container setup on CI that triggered it. This commit undoes the `chown -R` step in the CI workflow that had previously worked around this, and instead fixes it by having the gix-url `make_baseline.sh` fixture script run its `git fetch-pack` commands in a temporary repo created in a subdirectory of the fixture directory (and deleted afterwards).
1 parent 47f3819 commit d07c32d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,6 @@ jobs:
219219
apt-get install --no-install-recommends -y -- "${prerequisites[@]}"
220220
shell: bash
221221
- uses: actions/checkout@v4
222-
- name: Take ownership of repo
223-
# FIXME: Eliminate the need for this by improving the test suite not to rely on ownership
224-
# of preexisting files, nor on whether, where, or how we are contained in a repo (except
225-
# where gix-testtools checks ignores to suppress archives). Note that `safe.directory`
226-
# isn't a fix, due to config and environment sanitization when running fixture scripts.
227-
run: chown -R "$(whoami)" -- "$GITHUB_WORKSPACE"
228222
- uses: dtolnay/rust-toolchain@stable
229223
with:
230224
toolchain: stable-i686-unknown-linux-gnu # Otherwise it may misdetect based on the amd64 kernel.

gix-url/tests/fixtures/make_baseline.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,21 @@ tests_windows+=("c:repo")
5555
tests_unix+=("${tests[@]}")
5656
tests_windows+=("${tests[@]}")
5757

58+
# We will run `git fetch-pack` in this repo instead of the outer gitoxide repo,
59+
# for full isolation. This avoids assuming there *is* a gitoxide repo, and also
60+
# avoids `safe.directory` errors if the gitoxide repo has unusual ownership.
61+
git init -q temp-repo
62+
5863
for url in "${tests_unix[@]}"
5964
do
6065
echo ";" # there are no `;` in the tested urls
61-
git fetch-pack --diag-url "$url"
66+
git -C temp-repo fetch-pack --diag-url "$url"
6267
done >git-baseline.unix
6368

6469
for url in "${tests_windows[@]}"
6570
do
6671
echo ";" # there are no `;` in the tested urls
67-
git fetch-pack --diag-url "$url"
72+
git -C temp-repo fetch-pack --diag-url "$url"
6873
done >git-baseline.windows
74+
75+
rm -rf temp-repo

0 commit comments

Comments
 (0)