chiark / gitweb /
New policy: Only use test_expect_failure for broken tests
[stgit] / t / t1000-branch-create.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2006 Yann Dirson
4 #
5
6 test_description='Branch operations.
7
8 Exercises the "stg branch" commands.
9 '
10
11 . ./test-lib.sh
12
13 stg init
14
15 test_expect_success \
16     'Create a spurious patches/ entry' '
17     find .git -name foo | xargs rm -rf &&
18     mkdir -p .git/patches && touch .git/patches/foo
19 '
20
21 test_expect_success \
22     'Try to create an stgit branch with a spurious patches/ entry' '
23     ! stg branch -c foo
24 '
25
26 test_expect_success \
27     'Check that no part of the branch was created' '
28     test "`find .git -name foo | tee /dev/stderr`" = ".git/patches/foo" &&
29     ( grep foo .git/HEAD; test $? = 1 )
30 '
31
32 test_expect_success \
33     'Create a git branch' '
34     find .git -name foo | xargs rm -rf &&
35     cp .git/refs/heads/master .git/refs/heads/foo
36 '
37
38 test_expect_success \
39     'Try to create an stgit branch with an existing git branch by that name' '
40     ! stg branch -c foo
41 '
42
43 test_expect_success \
44     'Check that no part of the branch was created' '
45     test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
46     ( grep foo .git/HEAD; test $? = 1 )
47 '
48
49 test_expect_success \
50     'Create an invalid refs/heads/ entry' '
51     find .git -name foo | xargs rm -rf &&
52     touch .git/refs/heads/foo
53 '
54
55 test_done