- 'Check that no part of the branch was created' '
- test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
- ( grep foo .git/HEAD; test $? = 1 )
+ 'Setup two commits including removal of generated files' '
+ git init &&
+ touch file1 file2 &&
+ git add file1 file2 &&
+ git commit -m 1 &&
+ git rm file1 file2 &&
+ git commit -m 2 &&
+ touch file2
+'
+
+test_expect_success \
+ 'Create branch down the stack, behind the conflict caused by the generated file' '
+ ! stg branch --create foo4 master^
+'
+
+test_expect_success \
+ 'Check the branch was not created' '
+ test ! -e file1 &&
+ test "$(find .git -name foo4 | tee /dev/stderr | wc -l)" = 0 &&
+ test "$(git show-ref | grep foo4 | wc -l)" = 0 &&
+ test "$(git symbolic-ref HEAD)" = "refs/heads/master"