36 lines
1.3 KiB
Shell
Executable file
36 lines
1.3 KiB
Shell
Executable file
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/git-annex-test.XXXXXXXX")
|
|
source_repo=$tmpdir/source
|
|
mirror_repo=$tmpdir/mirror
|
|
export SOURCE_REPO="$source_repo"
|
|
export MIRROR_REPO="$mirror_repo"
|
|
|
|
if [[ -n ${GITHUB_ENV:-} ]]; then
|
|
printf 'SOURCE_REPO=%s\n' "$source_repo" >>"$GITHUB_ENV"
|
|
printf 'MIRROR_REPO=%s\n' "$mirror_repo" >>"$GITHUB_ENV"
|
|
fi
|
|
|
|
# source repo
|
|
git init -q -b main "$source_repo"
|
|
git -C "$source_repo" config user.name "Test User"
|
|
git -C "$source_repo" config user.email "test@example.invalid"
|
|
git -C "$source_repo" config commit.gpgsign false
|
|
git -C "$source_repo" annex init -q "test source"
|
|
printf 'initial annex content\n' >"$source_repo/file.txt"
|
|
git -C "$source_repo" annex add file.txt > /dev/null
|
|
git -C "$source_repo" commit -q -m "Add initial annexed file"
|
|
# extra refs
|
|
git -C "$source_repo" branch old-branch
|
|
git -C "$source_repo" tag v1
|
|
source_uuid=$(git -C "$source_repo" config --get annex.uuid)
|
|
|
|
# mirror repo (bare)
|
|
git init -q --bare "$mirror_repo"
|
|
git -C "$mirror_repo" config user.name "Test Mirror"
|
|
git -C "$mirror_repo" config user.email "mirror@example.invalid"
|
|
git -C "$mirror_repo" config commit.gpgsign false
|
|
git -C "$mirror_repo" annex init "test mirror" > /dev/null
|
|
git -C "$mirror_repo" remote add upstream "$source_repo"
|
|
mirror_uuid=$(git -C "$mirror_repo" config --get annex.uuid)
|