-test_expect_failure \
- 'Try to create an stgit branch with an existing git branch by that name' \
- 'find .git -name foo | xargs rm -rf &&
- cp .git/refs/heads/master .git/refs/heads/foo &&
- stg branch -c foo
+test_expect_success \
+ 'Try to create an stgit branch with an existing git branch by that name' '
+ ! stg branch -c foo
+'
+
+test_expect_success \
+ '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 )