From 02396b2a1b000fecaf9d42a4ab4251bf87da966f Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 2 Aug 2021 09:48:29 +0000 Subject: [PATCH] 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. --- ofborg/test-srcs/make-maintainer-pr.sh | 7 +++++-- ofborg/test-srcs/make-pr.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ofborg/test-srcs/make-maintainer-pr.sh b/ofborg/test-srcs/make-maintainer-pr.sh index b17a395..08433d9 100755 --- a/ofborg/test-srcs/make-maintainer-pr.sh +++ b/ofborg/test-srcs/make-maintainer-pr.sh @@ -4,19 +4,22 @@ set -eu bare=$1 co=$2 +export GIT_CONFIG_GLOBAL=/dev/null +export GIT_CONFIG_NOSYSTEM=1 + makepr() { git init --bare "$bare" git clone "$bare" "$co" cp -r maintainers/* "$co/" git -C "$co" add . - git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg " -m "initial repo commit" + git -C "$co" commit --author "GrahamCOfBorg " -m "initial repo commit" git -C "$co" push origin master cp maintainers-pr/* "$co/" git -C "$co" checkout -b my-cool-pr git -C "$co" add . - git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg " -m "check out this cool PR" + git -C "$co" commit --author "GrahamCOfBorg " -m "check out this cool PR" git -C "$co" push origin my-cool-pr:refs/pull/1/head } diff --git a/ofborg/test-srcs/make-pr.sh b/ofborg/test-srcs/make-pr.sh index 018c333..92e8ca7 100755 --- a/ofborg/test-srcs/make-pr.sh +++ b/ofborg/test-srcs/make-pr.sh @@ -4,19 +4,22 @@ set -eu bare=$1 co=$2 +export GIT_CONFIG_GLOBAL=/dev/null +export GIT_CONFIG_NOSYSTEM=1 + makepr() { git init --bare "$bare" git clone "$bare" "$co" cp build/* "$co/" git -C "$co" add . - git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg " -m "initial repo commit" + git -C "$co" commit --author "GrahamCOfBorg " -m "initial repo commit" git -C "$co" push origin master cp build-pr/* "$co/" git -C "$co" checkout -b my-cool-pr git -C "$co" add . - git -C "$co" commit --no-gpg-sign --author "GrahamCOfBorg " -m "check out this cool PR" + git -C "$co" commit --author "GrahamCOfBorg " -m "check out this cool PR" git -C "$co" push origin my-cool-pr:refs/pull/1/head }