Skip to content

Commit 2639ff4

Browse files
committed
e2e: use global 'user.email' config
1 parent 83bd660 commit 2639ff4

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

test_e2e.sh

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -197,17 +197,6 @@ function clean_work() {
197197
mkdir -p "$WORK"
198198
}
199199

200-
# config_repo sets required git config, so we don't depend on (shared) global git config.
201-
#
202-
# Args:
203-
# $1: directory of git repo
204-
function config_repo() {
205-
local repo=$1
206-
207-
git -C "$repo" config user.email "git-sync-test@example.com"
208-
git -C "$repo" config user.name "git-sync-test"
209-
}
210-
211200
# REPO and REPO2 are the source repos under test.
212201
REPO="$DIR/repo"
213202
REPO2="${REPO}2"
@@ -218,7 +207,6 @@ function init_repo() {
218207
rm -rf "$REPO"
219208
mkdir -p "$REPO"
220209
git -C "$REPO" init -q -b "$MAIN_BRANCH"
221-
config_repo "$REPO"
222210
echo "$arg" > "$REPO/file"
223211
git -C "$REPO" add file
224212
git -C "$REPO" commit -aqm "init file"
@@ -394,7 +382,6 @@ function e2e::init_root_is_under_another_repo() {
394382
mkdir -p "$ROOT/subdir/root"
395383
date > "$ROOT/subdir/root/file" # so it is not empty
396384
git -C "$ROOT/subdir" init -q
397-
config_repo "$ROOT/subdir"
398385

399386
GIT_SYNC \
400387
--one-time \
@@ -412,7 +399,6 @@ function e2e::init_root_is_under_another_repo() {
412399
function e2e::init_root_fails_sanity() {
413400
# Make an invalid git repo.
414401
git -C "$ROOT" init -q
415-
config_repo "$ROOT"
416402
echo "ref: refs/heads/nonexist" > "$ROOT/.git/HEAD"
417403

418404
GIT_SYNC \
@@ -2473,7 +2459,6 @@ function e2e::submodule_sync_default() {
24732459
mkdir "$SUBMODULE"
24742460

24752461
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2476-
config_repo "$SUBMODULE"
24772462
echo "submodule" > "$SUBMODULE/submodule.file"
24782463
git -C "$SUBMODULE" add submodule.file
24792464
git -C "$SUBMODULE" commit -aqm "init submodule.file"
@@ -2484,7 +2469,6 @@ function e2e::submodule_sync_default() {
24842469
mkdir "$NESTED_SUBMODULE"
24852470

24862471
git -C "$NESTED_SUBMODULE" init -q -b "$MAIN_BRANCH"
2487-
config_repo "$NESTED_SUBMODULE"
24882472
echo "nested-submodule" > "$NESTED_SUBMODULE/nested-submodule.file"
24892473
git -C "$NESTED_SUBMODULE" add nested-submodule.file
24902474
git -C "$NESTED_SUBMODULE" commit -aqm "init nested-submodule.file"
@@ -2581,7 +2565,6 @@ function e2e::submodule_sync_depth() {
25812565
mkdir "$SUBMODULE"
25822566

25832567
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2584-
config_repo "$SUBMODULE"
25852568

25862569
# First sync
25872570
expected_depth="1"
@@ -2662,7 +2645,6 @@ function e2e::submodule_sync_off() {
26622645
mkdir "$SUBMODULE"
26632646

26642647
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2665-
config_repo "$SUBMODULE"
26662648
echo "submodule" > "$SUBMODULE/submodule.file"
26672649
git -C "$SUBMODULE" add submodule.file
26682650
git -C "$SUBMODULE" commit -aqm "init submodule file"
@@ -2693,7 +2675,6 @@ function e2e::submodule_sync_shallow() {
26932675
mkdir "$SUBMODULE"
26942676

26952677
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2696-
config_repo "$SUBMODULE"
26972678
echo "submodule" > "$SUBMODULE/submodule.file"
26982679
git -C "$SUBMODULE" add submodule.file
26992680
git -C "$SUBMODULE" commit -aqm "init submodule file"
@@ -2704,7 +2685,6 @@ function e2e::submodule_sync_shallow() {
27042685
mkdir "$NESTED_SUBMODULE"
27052686

27062687
git -C "$NESTED_SUBMODULE" init -q -b "$MAIN_BRANCH"
2707-
config_repo "$NESTED_SUBMODULE"
27082688
echo "nested-submodule" > "$NESTED_SUBMODULE/nested-submodule.file"
27092689
git -C "$NESTED_SUBMODULE" add nested-submodule.file
27102690
git -C "$NESTED_SUBMODULE" commit -aqm "init nested-submodule file"
@@ -2741,7 +2721,6 @@ function e2e::submodule_sync_relative() {
27412721
mkdir "$SUBMODULE"
27422722

27432723
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2744-
config_repo "$SUBMODULE"
27452724
echo "submodule" > "$SUBMODULE/submodule.file"
27462725
git -C "$SUBMODULE" add submodule.file
27472726
git -C "$SUBMODULE" commit -aqm "init submodule file"
@@ -2778,7 +2757,6 @@ function e2e::submodule_sync_over_ssh_different_keys() {
27782757
mkdir "$NESTED_SUBMODULE"
27792758

27802759
git -C "$NESTED_SUBMODULE" init -q -b "$MAIN_BRANCH"
2781-
config_repo "$NESTED_SUBMODULE"
27822760
echo "nested-submodule" > "$NESTED_SUBMODULE/nested-submodule.file"
27832761
git -C "$NESTED_SUBMODULE" add nested-submodule.file
27842762
git -C "$NESTED_SUBMODULE" commit -aqm "init nested-submodule.file"
@@ -2799,7 +2777,6 @@ function e2e::submodule_sync_over_ssh_different_keys() {
27992777
mkdir "$SUBMODULE"
28002778

28012779
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2802-
config_repo "$SUBMODULE"
28032780
echo "submodule" > "$SUBMODULE/submodule.file"
28042781
git -C "$SUBMODULE" add submodule.file
28052782
git -C "$SUBMODULE" commit -aqm "init submodule.file"
@@ -2858,7 +2835,6 @@ function e2e::submodule_sync_over_http_different_passwords() {
28582835
mkdir "$NESTED_SUBMODULE"
28592836

28602837
git -C "$NESTED_SUBMODULE" init -q -b "$MAIN_BRANCH"
2861-
config_repo "$NESTED_SUBMODULE"
28622838
echo "nested-submodule" > "$NESTED_SUBMODULE/nested-submodule.file"
28632839
git -C "$NESTED_SUBMODULE" add nested-submodule.file
28642840
git -C "$NESTED_SUBMODULE" commit -aqm "init nested-submodule.file"
@@ -2877,7 +2853,6 @@ function e2e::submodule_sync_over_http_different_passwords() {
28772853
mkdir "$SUBMODULE"
28782854

28792855
git -C "$SUBMODULE" init -q -b "$MAIN_BRANCH"
2880-
config_repo "$SUBMODULE"
28812856
echo "submodule" > "$SUBMODULE/submodule.file"
28822857
git -C "$SUBMODULE" add submodule.file
28832858
git -C "$SUBMODULE" commit -aqm "init submodule.file"
@@ -3399,6 +3374,8 @@ function run_test() {
33993374
# Override local configs for predictability in this test.
34003375
export GIT_CONFIG_GLOBAL="$DIR/gitconfig"
34013376
export GIT_CONFIG_SYSTEM=/dev/null
3377+
git config --global user.email "git-sync-test@example.com"
3378+
git config --global user.name "git-sync-test"
34023379

34033380
# Make sure files we create can be group writable.
34043381
umask 0002

0 commit comments

Comments
 (0)