Test the format version upgrade code
[stgit/ydirson.git] / t / t1000-branch-create.sh
blobcca5504d4f19fc3ab02ea6fe0388a23745ce48c9
1 #!/bin/sh
3 # Copyright (c) 2006 Yann Dirson
6 test_description='Branch operations.
8 Exercises the "stg branch" commands.
11 . ./test-lib.sh
13 stg init
15 test_expect_success \
16 'Create a spurious refs/patches/ entry' '
17 find .git -name foo | xargs rm -rf &&
18 touch .git/refs/patches/foo
21 test_expect_failure \
22 'Try to create an stgit branch with a spurious refs/patches/ entry' '
23 stg branch -c foo
26 test_expect_success \
27 'Check that no part of the branch was created' '
28 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/patches/foo" &&
29 ( grep foo .git/HEAD; test $? = 1 )
32 test_expect_success \
33 'Create a spurious patches/ entry' '
34 find .git -name foo | xargs rm -rf &&
35 touch .git/patches/foo
38 test_expect_failure \
39 'Try to create an stgit branch with a spurious patches/ entry' '
40 stg branch -c foo
43 test_expect_success \
44 'Check that no part of the branch was created' '
45 test "`find .git -name foo | tee /dev/stderr`" = ".git/patches/foo" &&
46 ( grep foo .git/HEAD; test $? = 1 )
49 test_expect_success \
50 'Create a git branch' '
51 find .git -name foo | xargs rm -rf &&
52 cp .git/refs/heads/master .git/refs/heads/foo
55 test_expect_failure \
56 'Try to create an stgit branch with an existing git branch by that name' '
57 stg branch -c foo
60 test_expect_success \
61 'Check that no part of the branch was created' '
62 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
63 ( grep foo .git/HEAD; test $? = 1 )
66 test_expect_success \
67 'Create an invalid refs/heads/ entry' '
68 find .git -name foo | xargs rm -rf &&
69 touch .git/refs/heads/foo
72 test_expect_failure \
73 'Try to create an stgit branch with an invalid refs/heads/ entry' '
74 stg branch -c foo
77 test_expect_success \
78 'Check that no part of the branch was created' '
79 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
80 ( grep foo .git/HEAD; test $? = 1 )
83 test_done