forked from alibaba/git-repo-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
t0204-sync-mirror.sh
executable file
·60 lines (51 loc) · 1.3 KB
/
t0204-sync-mirror.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
test_description="sync overwrites dirty workdir if workdir is in detached mode"
. lib/test-lib.sh
# Create manifest repositories
manifest_url="file://${REPO_TEST_REPOSITORIES}/hello/manifests"
test_expect_success "setup" '
# create .repo file as a barrier, not find .repo deeper
touch .repo &&
mkdir work
'
test_expect_success "git-repo sync in mirror mode" '
(
cd work &&
git-repo init -u $manifest_url -g all --mirror -b Maint &&
git-repo sync \
--mock-ssh-info-status 200 \
--mock-ssh-info-response \
"{\"host\":\"ssh.example.com\", \"port\":22, \"type\":\"agit\"}"
)
'
test_expect_success "no project repositories in .repo" '
(
cd work &&
test -d .repo/manifests.git &&
test ! -d .repo/projects &&
test ! -d .repo/project-objects
)
'
test_expect_success "project repositories in workspace" '
(
cd work &&
test -d hello/manifests.git &&
test -d drivers/driver1.git &&
test -d drivers/driver2.git &&
test -d main.git &&
test -d project1.git &&
test -d project2.git &&
test -d project1/module1.git
)
'
test_expect_success "git-repo init with tag" '
(
cd work &&
git-repo init -b refs/tags/v0.2 &&
git-repo sync \
--mock-ssh-info-status 200 \
--mock-ssh-info-response \
"{\"host\":\"ssh.example.com\", \"port\":22, \"type\":\"agit\"}"
)
'
test_done