3 # Copyright (c) 2006 Yann Dirson
6 test_description='Branch operations.
8 Exercises the "stg branch" commands.
14 'Create a branch when the current one is not an StGIT stack' '
16 stg branch --create new origin &&
17 test $(stg branch) = "new"
21 'Create a spurious patches/ entry' '
24 find .git -name foo | xargs rm -rf &&
25 mkdir -p .git/patches && touch .git/patches/foo
29 'Try to create an stgit branch with a spurious patches/ entry' '
34 'Check that no part of the branch was created' '
35 test "`find .git -name foo | tee /dev/stderr`" = ".git/patches/foo" &&
36 ( grep foo .git/HEAD; test $? = 1 )
40 'Create a git branch' '
41 find .git -name foo | xargs rm -rf &&
42 cp .git/refs/heads/master .git/refs/heads/foo
46 'Try to create an stgit branch with an existing git branch by that name' '
51 'Check that no part of the branch was created' '
52 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
53 ( grep foo .git/HEAD; test $? = 1 )
57 'Create an invalid refs/heads/ entry' '
58 find .git -name foo | xargs rm -rf &&
59 touch .git/refs/heads/foo &&
64 'Setup two commits including removal of generated files' '
75 'Create branch down the stack, behind the conflict caused by the generated file' '
76 ! stg branch --create bar master^
80 'Check the branch was not created' '
81 test ! -r .git/refs/heads/bar &&