-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·104 lines (81 loc) · 1.38 KB
/
test.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
src=`pwd`
dir=$src/git-soc-test
base="$dir/git-soc-base"
counter=1
cmd() {
echo "=== $@"
"$@"
}
cleanandinit() {
# clean up and init
cmd rm -rf $dir
cmd mkdir -p $base
}
mkrepo() {
name="$1"
mkdir -p $dir/$name
pushd $dir/$name
git init --bare
popd
}
clonerepo() {
repo="$1"
subdir="$2"
pushd $dir
git clone $1 $2
popd
}
registerrepo() {
repo="$1"
pushd $dir/$repo
gitsoc register $repo
popd
}
title() {
echo ""
echo "========== $@"
}
gitsoc() {
cmd $src/git-soc "$@" -B $base
}
mkmod() {
repo="$1"
pushd $dir/$repo
echo $counter > counter
git add counter
git commit -m "counter $counter" counter
counter=$(($counter + 1))
popd
}
########################################
cleanandinit
title" making repos"
mkrepo repo1
mkrepo repo2
title "cloning repos"
clonerepo repo1 repo1.w1
clonerepo repo1 repo1.w2
clonerepo repo2 repo2.w1
clonerepo repo2 repo2.w2
title "git-soc register"
registerrepo repo1.w1
registerrepo repo2.w1
registerrepo repo1.w2
registerrepo repo2.w2
title "status"
gitsoc status
title "make modifications"
mkmod repo1.w1
mkmod repo2.w1
title "status"
gitsoc status
title "push"
gitsoc push
title "pp"
gitsoc pull
title "push"
gitsoc push
cat $base/repo1.w1.yml | sed 's/w1/w3/' > $base/repo1.w3.yml
title "pull a new directory"
gitsoc pull