-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·97 lines (81 loc) · 1.5 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
#!/bin/bash
set -e
_check()
{
[ "$(git-qseries | tr -d '\n')" = "$1" ]
[ "$(git-qapplied | tr -d '\n')" = "$2" ]
[ "$(git-qunapplied | tr -d '\n')" = "$3" ]
[ "$(cat a)" = "$4" ]
if [ "$(git-qnext)" != "" ]; then
git-qshow | git apply
git reset --hard
fi
}
PATH="..:$PATH"
mkdir tmp
cd tmp
# create a test repository
git init
touch a
git add a
git commit -a -m a
for i in 1 2 3; do
echo patch$i > a
git commit -a -m patch$i
done
git branch backup
git-qinit
# check git-qrevert
git-qrevert master^^^
for i in 1 2 3; do
git-qrename "${i}_patch$i" "$i"
done
_check "123" "" "123" ""
git-qpush
_check "123" "1" "23" "patch1"
git-qcommit
git-qrevert master^
git-qrename "patch1" "1"
_check "123" "" "123" ""
git-qpop
_check "123" "" "123" ""
git-qpush
git-qpop
git-qpush
git-qpush
git-qpop
git-qpop
git-qpush
git-qpush
git-qcommit
_check "3" "" "3" "patch2"
# check git-qpick
git reset master^^ --hard
git-qpick backup^
git-qrename "patch2" "2"
git-qpick backup^^
git-qrename "patch1" "1"
tac .git/patches/master/series > .git/patches/master/series.tmp
mv .git/patches/master/series.tmp .git/patches/master/series
_check "123" "" "123" ""
git-qpush
git-qpush
git-qpush
_check "123" "123" "" "patch3"
git-qcommit
_check "" "" "" "patch3"
# check git-qimport
git format-patch -3
git-qimport *.patch
git reset master^^^ --hard
for i in 1 2 3; do
git-qrename "${i}_patch$i" "$i"
done
git-qpush
git-qpush
git-qpush
_check "123" "123" "" "patch3"
# cleanup
cd ..
rm -rf tmp
echo "** Passed **"