Don't use global git config in tests

The tests were failing for me because I have git configured to use
"main" instead of "master" as the default initial branch name for new
repositories.  Having the tests use global git configuration from
developer systems is just asking for trouble with non-reproducibility,
but fortunately git gives us a mechanism to disable it.

This also means we don't need to worry about GPG any more.
This commit is contained in:
Alyssa Ross 2021-08-02 09:48:29 +00:00 committed by Cole Helbling
parent 9ded230796
commit 02396b2a1b
2 changed files with 10 additions and 4 deletions

View file

@ -4,19 +4,22 @@ set -eu
bare=$1 bare=$1
co=$2 co=$2
export GIT_CONFIG_GLOBAL=/dev/null
export GIT_CONFIG_NOSYSTEM=1
makepr() { makepr() {
git init --bare "$bare" git init --bare "$bare"
git clone "$bare" "$co" git clone "$bare" "$co"
cp -r maintainers/* "$co/" cp -r maintainers/* "$co/"
git -C "$co" add . git -C "$co" add .
git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "initial repo commit" git -C "$co" commit --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "initial repo commit"
git -C "$co" push origin master git -C "$co" push origin master
cp maintainers-pr/* "$co/" cp maintainers-pr/* "$co/"
git -C "$co" checkout -b my-cool-pr git -C "$co" checkout -b my-cool-pr
git -C "$co" add . git -C "$co" add .
git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "check out this cool PR" git -C "$co" commit --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "check out this cool PR"
git -C "$co" push origin my-cool-pr:refs/pull/1/head git -C "$co" push origin my-cool-pr:refs/pull/1/head
} }

View file

@ -4,19 +4,22 @@ set -eu
bare=$1 bare=$1
co=$2 co=$2
export GIT_CONFIG_GLOBAL=/dev/null
export GIT_CONFIG_NOSYSTEM=1
makepr() { makepr() {
git init --bare "$bare" git init --bare "$bare"
git clone "$bare" "$co" git clone "$bare" "$co"
cp build/* "$co/" cp build/* "$co/"
git -C "$co" add . git -C "$co" add .
git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "initial repo commit" git -C "$co" commit --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "initial repo commit"
git -C "$co" push origin master git -C "$co" push origin master
cp build-pr/* "$co/" cp build-pr/* "$co/"
git -C "$co" checkout -b my-cool-pr git -C "$co" checkout -b my-cool-pr
git -C "$co" add . git -C "$co" add .
git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "check out this cool PR" git -C "$co" commit --author "GrahamCOfBorg <graham+cofborg@example.com>" -m "check out this cool PR"
git -C "$co" push origin my-cool-pr:refs/pull/1/head git -C "$co" push origin my-cool-pr:refs/pull/1/head
} }