aboutsummaryrefslogtreecommitdiff
path: root/tests/remotes.sh
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-22 18:29:34 -0300
committerEuAndreh <eu@euandre.org>2021-06-22 18:29:34 -0300
commit670529ed8e5978b17bd0cfd7e1133b0232200886 (patch)
tree432e69f7b0f72b8ac6d23123d3692634cc368a8b /tests/remotes.sh
parentaux/tests-lib.sh: Add uuid() function, use it on tests (diff)
downloadgit-permalink-670529ed8e5978b17bd0cfd7e1133b0232200886.tar.gz
git-permalink-670529ed8e5978b17bd0cfd7e1133b0232200886.tar.xz
tests/remotes.sh: Conditionally set user.{email,name} to work on new env like CI
Diffstat (limited to 'tests/remotes.sh')
-rwxr-xr-xtests/remotes.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/remotes.sh b/tests/remotes.sh
index 0b52513..4a7ced1 100755
--- a/tests/remotes.sh
+++ b/tests/remotes.sh
@@ -7,11 +7,21 @@ TEST_PREFIX="$PWD/tests/prefix/$(uuid)"
make PREFIX="$TEST_PREFIX" install 1>/dev/null
PATH="$PWD/tests:$TEST_PREFIX/bin:$PATH"
+if ! git config --global user.email; then
+ git config --global user.email email@example.com
+fi
+if ! git config --global user.name; then
+ git config --global user.name Example
+fi
+
new_repo() {
REPO="$PWD/tests/remotes/$(uuid)"
mkdir -p "$REPO"
cd "$REPO" || exit 1
- git init > /dev/null
+ git init 1>/dev/null 2>/dev/null || {
+ git config --global init.defaultBranch
+
+ }
git remote add origin "$1"
echo '' > f.txt
git add f.txt