Skip to content

Commit 44660be

Browse files
committed
Fixed 'make test' for debian build
Initialize own git repo, if project isn't a git clone. Local git config 'autocrlf' has been removed. Local default branches were set for all test repos. Tests were adapted for all local git configurations. Run tests with fixed locale.
1 parent ca265e0 commit 44660be

File tree

8 files changed

+54
-20
lines changed

8 files changed

+54
-20
lines changed

test/clone.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ clone-foo-and-bar
1010

1111
(
1212
mkdir -p "$OWNER/empty"
13-
git init "$OWNER/empty"
13+
git init --initial-branch=$DEFAULTBRANCH "$OWNER/empty"
1414
)
1515

1616
# Test that the repos look ok:

test/config.t

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ gitrepo=$OWNER/init/doc/.gitrepo
1313

1414
(
1515
cd "$OWNER/init"
16+
git config user.email "ini@ini"
17+
git config user.name "IniUser"
18+
git config init.defaultBranch $DEFAULTBRANCH
1619
git subrepo init doc
1720
) > /dev/null
1821

test/init.t

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ gitrepo=$OWNER/init/doc/.gitrepo
2222

2323
output=$(
2424
cd "$OWNER/init"
25+
git config user.email "ini@ini"
26+
git config user.name "IniUser"
27+
git config init.defaultBranch $DEFAULTBRANCH
2528
git subrepo init doc
2629
)
2730

@@ -48,6 +51,9 @@ rm -fr "$OWNER/init"
4851
git clone "$UPSTREAM/init" "$OWNER/init" &>/dev/null
4952
(
5053
cd "$OWNER/init"
54+
git config user.email "ini@ini"
55+
git config user.name "IniUser"
56+
git config init.defaultBranch $DEFAULTBRANCH
5157
git subrepo init doc -r git@github.com:user/repo -b foo -M rebase
5258
) >/dev/null
5359

test/issue29.t

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ cd "$TMP"
1818
# Make 3 new repos:
1919
(
2020
mkdir share main1 main2
21-
git init share
22-
git init main1
23-
git init main2
21+
git init --initial-branch=$DEFAULTBRANCH share
22+
git init --initial-branch=$DEFAULTBRANCH main1
23+
git init --initial-branch=$DEFAULTBRANCH main2
2424
) > /dev/null
2525

2626
# Add an empty 'readme' to the share repo:
2727
(
2828
cd share
29+
git config user.name "ShrUser"
30+
git config user.email "shr@ma1"
2931
echo '* text eol=lf' > .gitattributes
3032
touch readme
3133
git add readme .gitattributes
@@ -37,6 +39,8 @@ cd "$TMP"
3739
# `subrepo clone` the share repo into main1:
3840
(
3941
cd main1
42+
git config user.name "Ma1User"
43+
git config user.email "ma1@ma1"
4044
touch main1
4145
git add main1
4246
git commit -m "Initial main1"
@@ -46,6 +50,8 @@ cd "$TMP"
4650
# `subrepo clone` the share repo into main2:
4751
(
4852
cd main2
53+
git config user.name "Ma2User"
54+
git config user.email "ma2@ma2"
4955
touch main2
5056
git add main2
5157
git commit -m "Initial main2"

test/issue95.t

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ use Test::More
1212
# Make two new repos
1313
(
1414
mkdir host sub
15-
git init host
16-
git init sub
15+
git init --initial-branch=$DEFAULTBRANCH host
16+
git init --initial-branch=$DEFAULTBRANCH sub
1717
) > /dev/null
1818

1919
# Initialize host repo
2020
(
2121
cd host
22+
git config user.name "HstUser"
23+
git config user.email "hst@hst"
2224
touch host
2325
git add host
2426
git commit -m "host initial commit"
@@ -27,7 +29,8 @@ use Test::More
2729
# Initialize sub repo
2830
(
2931
cd sub
30-
git init
32+
git config user.name "SubUser"
33+
git config user.email "sub@sub"
3134
touch subrepo
3235
git add subrepo
3336
git commit -m "subrepo initial commit"

test/issue96.t

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ use Test::More
1111
# Make two new repos
1212
(
1313
mkdir host sub
14-
git init host
15-
git init sub
14+
git init --initial-branch=$DEFAULTBRANCH host
15+
git init --initial-branch=$DEFAULTBRANCH sub
1616
) > /dev/null
1717

1818
# Initialize host repo
1919
(
2020
cd host
21+
git config user.name "HstUser"
22+
git config user.email "hst@hst"
2123
touch host
2224
git add host
2325
git commit -m "host initial commit"
@@ -26,7 +28,8 @@ use Test::More
2628
# Initialize sub repo
2729
(
2830
cd sub
29-
git init
31+
git config user.name "SubUser"
32+
git config user.email "sub@sub"
3033
touch subrepo
3134
git add subrepo
3235
git commit -m "subrepo initial commit"

test/push-after-init.t

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ use Test::More
1212
(
1313
mkdir -p "$OWNER/init"
1414
cd "$OWNER/init"
15-
git init
15+
git init --initial-branch=$DEFAULTBRANCH
16+
git config user.name "IniUser"
17+
git config user.email "ini@ini"
1618
mkdir doc
1719
add-new-files doc/FooBar
1820
git subrepo init doc || die
1921
mkdir ../upstream
20-
git init --bare ../upstream || die
22+
git init --initial-branch=$DEFAULTBRANCH --bare ../upstream || die
23+
cd ../upstream
24+
git config user.name "UpsUser"
25+
git config user.email "ups@ups"
26+
cd -
2127
) &> /dev/null
2228

2329
output=$(

test/setup

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
#!/usr/bin/env bash
22

3-
# Set this locally for Windows:
4-
git config core.autocrlf input
5-
63
set -e
74

8-
# Set the GIT_SUBREPO_ROOT for testing.
9-
source "$PWD"/.rc
5+
export LC_ALL=C.UTF-8
106

117
# Get the location of this script
128
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
139

10+
# Running tests depends on the whole project being git initialized.
11+
# So, git initialize the project, if necessary.
12+
if [ ! -d "${SCRIPT_DIR}/../.git" ]; then
13+
git init -b master .
14+
git config user.email "you@you"
15+
git config user.name "YouUser"
16+
git add .
17+
git commit -a -m"Initial commit"
18+
git config --list
19+
fi
20+
1421
BASHLIB=$(
15-
find "$PWD"/ -type d -name bin -o -type d -name lib | tr '\n' ':'
22+
find "$PWD"/ -type d -name bin -o -type d -name lib | grep -v "\/\.pc\/" | tr '\n' ':'
1623
)
1724
export BASHLIB
1825

@@ -46,17 +53,17 @@ clone-foo-and-bar() {
4653
git clone "$UPSTREAM/foo" "$OWNER/foo"
4754
(
4855
cd "$OWNER/foo"
49-
git config core.autocrlf input
5056
git config user.name "FooUser"
5157
git config user.email "foo@foo"
58+
git config init.defaultBranch $DEFAULTBRANCH
5259
)
5360
# bar will act as the subrepo
5461
git clone "$UPSTREAM/bar" "$OWNER/bar"
5562
(
5663
cd "$OWNER/bar"
57-
git config core.autocrlf input
5864
git config user.name "BarUser"
5965
git config user.email "bar@bar"
66+
git config init.defaultBranch $DEFAULTBRANCH
6067
)
6168
) &> /dev/null || die
6269
}

0 commit comments

Comments
 (0)