revision: add --except option
[git] / t / t6112-rev-list-except.sh
1 #!/bin/sh
2
3 test_description='test for rev-list --except'
4
5 . ./test-lib.sh
6
7 test_expect_success 'setup' '
8
9         echo one > content &&
10         git add content &&
11         git commit -m one &&
12         git checkout -b test master &&
13         echo two > content &&
14         git commit -a -m two &&
15         git checkout -b merge master &&
16         git merge test
17 '
18
19 test_expect_success 'rev-list --except' '
20
21         git rev-list --topo-order --branches --except merge > actual &&
22         git rev-list --topo-order test > expect &&
23         test_cmp expect actual
24 '
25
26 test_expect_success 'rev-list --except with extra' '
27
28         echo three > content &&
29         git commit -a -m three &&
30         git rev-list --topo-order --branches --except merge > actual &&
31         git rev-list --topo-order test > expect &&
32         test_cmp expect actual
33 '
34
35 test_expect_success 'rev-list --except with full ref' '
36
37         git rev-list --topo-order --branches --except refs/heads/merge > actual &&
38         git rev-list --topo-order test > expect &&
39         test_cmp expect actual
40 '
41
42 test_expect_success 'rev-list --except and --not' '
43
44         git rev-list --topo-order test --not master --except master > actual &&
45         git rev-list --topo-order test > expect &&
46         test_cmp expect actual
47 '
48
49 test_expect_success 'rev-list --except and --not with proper flags' '
50
51         git checkout -b maint master &&
52         git checkout -b next test &&
53         echo four > content &&
54         git commit -a -m four &&
55         git rev-list --topo-order next --not master maint --except maint > actual &&
56         git rev-list --topo-order next --not master > expect &&
57         test_cmp expect actual
58 '
59
60 test_expect_success 'rev-list --not ranges' '
61
62         git rev-list --topo-order test --not master --except master test > actual &&
63         git rev-list --topo-order test > expect &&
64         test_cmp expect actual
65 '
66
67 test_expect_success 'rev-list multiple --not ranges' '
68
69         git checkout -b extra test &&
70         echo five > content &&
71         git commit -a -m five &&
72         git rev-list --topo-order test --not master --except master test --not extra > actual &&
73         git rev-list --topo-order test extra > expect &&
74         test_cmp expect actual
75 '
76
77 test_done