Remove unused argument from mergetool()
[stgit.git] / t / t1007-branch-protect.sh
blobac87909219c5c9f2230c7d1c0d0457d1622402ff
1 #!/bin/sh
3 test_description='Test branch protection'
5 . ./test-lib.sh
7 test_expect_success 'Initialize branch' '
8 stg init &&
9 stg branch --create foo &&
10 echo "hello" > bar &&
11 stg add bar &&
12 stg new -m p0 &&
13 stg refresh
16 test_expect_success 'Invald num args to protect' '
17 command_error stg branch --protect foo bar 2>&1 |
18 grep "incorrect number of arguments"
21 test_expect_success 'Protect branch' '
22 stg branch --protect
25 test_expect_success 'List protected' '
26 stg branch --list |
27 grep -E "> sp[[:space:]]+foo"
30 test_expect_success 'Protect idempotency' '
31 stg branch --protect foo
34 test_expect_success 'Attempt cleanup protected' '
35 command_error stg branch --cleanup 2>&1 |
36 grep "This branch is protected"
39 test_expect_success 'Attempt delete protected' '
40 stg branch master &&
41 command_error stg branch --delete foo 2>&1 |
42 grep "This branch is protected"
45 test_expect_success 'Invalid num arts to unprotect' '
46 command_error stg branch --unprotect foo bar 2>&1 |
47 grep "incorrect number of arguments"
50 test_expect_success 'Unprotect branch' '
51 stg branch --unprotect foo
54 test_expect_success 'List unprotected' '
55 stg branch --list |
56 grep -E " s[[:space:]]+foo"
59 test_expect_success 'Unprotect idempotency' '
60 stg branch foo &&
61 stg branch --unprotect &&
62 stg branch --list |
63 grep -E "> s[[:space:]]+foo"
66 test_expect_success 'Cleanup unprotected' '
67 stg commit -a &&
68 stg branch --cleanup
71 test_expect_success 'Protect uninitialized branch' '
72 command_error stg branch --protect 2>&1 |
73 grep -E "is not controlled by StGIT"
76 test_expect_success 'Protect uninitialized branch' '
77 command_error stg branch --unprotect 2>&1 |
78 grep -E "is not controlled by StGIT"
81 test_expect_success 'Delete unprotected' '
82 stg branch master &&
83 stg branch --delete foo
86 test_done