diff options
-rw-r--r-- | .github/workflows/ci.yml | 4 | ||||
-rw-r--r-- | test/integration/docker/git_server/Dockerfile | 1 | ||||
-rwxr-xr-x | test/integration/local/test.sh | 29 |
3 files changed, 21 insertions, 13 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51a5266..dedadd7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,10 +28,6 @@ jobs: with: python-version: '${{ matrix.python-version }}' cache: pip - - name: Initialize Git - run: | - git config --global user.name 'John Doe' - git config --global user.email 'John.Doe@example.com' - name: 'Install package & dependencies' run: pip install -q -e . - name: Verify that scripts are runnable diff --git a/test/integration/docker/git_server/Dockerfile b/test/integration/docker/git_server/Dockerfile index a33bce3..55b3362 100644 --- a/test/integration/docker/git_server/Dockerfile +++ b/test/integration/docker/git_server/Dockerfile @@ -4,6 +4,7 @@ RUN apk add -q --no-cache bash git openssh-server tini && \ echo 'root:root' | chpasswd && \ git config --global user.name 'John Doe' && \ git config --global user.email 'John.Doe@example.com' && \ + git config --global init.defaultBranch main && \ sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config WORKDIR /root diff --git a/test/integration/local/test.sh b/test/integration/local/test.sh index 05de5ac..96ab2c5 100755 --- a/test/integration/local/test.sh +++ b/test/integration/local/test.sh @@ -12,6 +12,17 @@ readonly etc_dir="$script_dir/etc" readonly cgitize_toml_path="$etc_dir/cgitize.toml" readonly output_dir="$script_dir/output" +readonly git_name='John Doe' +readonly git_email='John.Doe@example.com' +readonly git_default_branch=main + +_git() { + git -c "user.name=$git_name" \ + -c "user.email=$git_email" \ + -c "init.defaultBranch=$git_default_branch" \ + "$@" +} + success() { echo echo ---------------------------------------------------------------------- @@ -42,13 +53,13 @@ setup_upstream_repo() { upstream_repo_dir="$( mktemp -d )" pushd -- "$upstream_repo_dir" > /dev/null - git init + _git init echo '1' > 1.txt - git add . - git commit -m 'first commit' + _git add . + _git commit -m 'first commit' echo '2' > 2.txt - git add . - git commit -m 'second commit' + _git add . + _git commit -m 'second commit' popd > /dev/null } @@ -62,8 +73,8 @@ add_commits() { pushd -- "$upstream_repo_dir" > /dev/null echo '3' > 3.txt - git add . - git commit -m 'third commit' + _git add . + _git commit -m 'third commit' popd > /dev/null } @@ -105,7 +116,7 @@ setup_workdir() { echo ---------------------------------------------------------------------- mkdir -p -- "$output_dir" - git clone --quiet -- "$upstream_repo_dir" "$output_dir/test_repo" + _git clone --quiet -- "$upstream_repo_dir" "$output_dir/test_repo" } cgitize() { @@ -144,7 +155,7 @@ verify_commits() { pushd -- "$output_dir" > /dev/null && cd -- test_repo.git && local output && - output="$( git log --oneline )" && + output="$( _git log --oneline )" && echo "$output" && check_contains "$output" "$@" && popd > /dev/null |