From 4d974f0d44c9f6398fc9d46215a4572329f1fbd5 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 12 Jul 2023 17:50:48 +0200 Subject: test: no need to pre-configure git, remove some warnings --- test/integration/local/test.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'test/integration/local/test.sh') 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 -- cgit v1.2.3