Skip to content

Commit

Permalink
Don't set global Git config when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmurty committed Sep 9, 2024
1 parent 5b598d8 commit f88979c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/_test_helper.bash
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ function init_git_repo {
echo "WARNING: Test repo already exists at $BATS_TEST_DIRNAME/.git"
else
# Configure "main" as the default branch name
git config --global init.defaultBranch main
git config --local init.defaultBranch main
# Initialise test git repo at the same path as the test files
git init "$BATS_TEST_DIRNAME"
git checkout -b main
# Tests will fail if name and email aren't set
git config user.name "John Doe"
git config user.email johndoe@example.com
git config --local user.name "John Doe"
git config --local user.email johndoe@example.com
# Flag test git repo as 100% the test one, for safety before later removal
touch "$BATS_TEST_DIRNAME"/.git/repo-for-transcrypt-bats-tests
fi
Expand Down

0 comments on commit f88979c

Please sign in to comment.