Test for generated patchname with trailing period
[stgit.git] / t / t1005-branch-delete.sh
blobcb218489616fdf8017e9001c6fd624fea7ec144a
1 #!/bin/sh
3 test_description='Attempt to delete branches'
5 . ./test-lib.sh
7 test_expect_success 'Initialize repo' '
8 stg init &&
9 test_commit p0 &&
10 test_commit p1 &&
11 stg uncommit -n 2
14 test_expect_success 'Create a branch (and switch to it)' '
15 stg branch --clone foo
18 test_expect_success 'Attempt to delete branch with patches' '
19 command_error stg branch --delete master 2>&1 |
20 grep -e "series still contains patches"
23 test_expect_success 'Force delete branch with patches' '
24 stg branch --delete --force master
27 test_expect_success 'Make sure the branch ref was deleted' '
28 [ -z "$(git show-ref | grep master | tee /dev/stderr)" ]
31 test_expect_success 'Make sure the branch config was deleted' '
32 [ -z "$(git config -l | grep branch\\.master | tee /dev/stderr)" ]
35 test_expect_success 'Make sure the branch files were deleted' '
36 [ -z "$(find .git -type f | grep master | tee /dev/stderr)" ]
39 test_expect_success 'Attempt to delete current branch' '
40 command_error stg branch --delete $(stg branch) 2>&1 |
41 grep -e "Cannot delete the current branch"
44 test_expect_success 'Invalid num args to delete' '
45 command_error stg branch --delete 2>&1 |
46 grep -e "incorrect number of arguments" &&
47 command_error stg branch --delete foo extra 2>&1 |
48 grep -e "incorrect number of arguments"
51 test_expect_success 'Create a non-StGit branch and delete it' '
52 git branch bar &&
53 stg branch --delete bar
56 test_expect_success 'Delete a nonexistent branch' '
57 command_error stg branch --delete bar 2>&1 |
58 grep -e "no such branch"
61 test_done