Ignore empty/commented series lines
[gq.git] / regression / 050-series.sh
blob58d49acad4bea40c80209e527864a045dfc27d68
2 # Test the series parsing code
5 source scaffold
7 function prepare_for_tests
9 # set up the repo so we have something interesting to run gq on
10 echo "abc" > def
11 git-add def
12 git-commit -s -m "initial" 2> /dev/null > /dev/null
14 # patch to modify a file
15 cat << DONE > .git/patches/master/modify
16 diff --git a/def b/def
17 index 8baef1b..7d69c2f 100644
18 --- a/def
19 +++ b/def
20 @@ -1 +1,2 @@
21 abc
22 +asjhfksad
23 DONE
25 # patch to add a new file
26 cat << DONE > .git/patches/master/add
27 diff --git a/abd b/abd
28 new file mode 100644
29 index 0000000..489450e
30 --- /dev/null
31 +++ b/abd
32 @@ -0,0 +1 @@
33 +qweert
34 DONE
36 # patch to remove an existing file
37 cat << DONE > .git/patches/master/remove
38 diff --git a/abd b/abd
39 deleted file mode 100644
40 index 489450e..0000000
41 --- a/abd
42 +++ /dev/null
43 @@ -1 +0,0 @@
44 -qweert
45 DONE
47 # patch to change a mode
48 cat << DONE > .git/patches/master/mode
49 diff --git a/def b/def
50 old mode 100644
51 new mode 100755
52 DONE
54 # the series file of all the things
55 cat << DONE > .git/patches/master/series
59 # foo
64 # some text
65 # some text
66 modify
67 add
69 remove
70 mode
71 #sure
72 DONE
75 function expected_series
77 echo "modify"
78 echo "add"
79 echo "remove"
80 echo "mode"
83 # the test itself
84 empty_repo
85 cd $REPODIR
86 gq-init
88 prepare_for_tests
90 # NOTE: this has to be in the same order as the series file
91 tests="empty modify add remove mode"
93 for t in $tests
95 [ "$t" != "empty" ] && gq-push > /dev/null
97 gq-series > /tmp/reg.$$
99 expected_series | diff -u - /tmp/reg.$$
101 echo -n "[$t] "
102 done
104 rm -f /tmp/reg.$$
106 complete_test