Improve test coverage for stg pull
[stgit.git] / t / t1002-branch-clone.sh
blob52eedf948eb902a41d07be62ed534c99556173cd
1 #!/bin/sh
3 # Copyright (c) 2006 Catalin Marinas
6 test_description='Branch cloning.
8 Exercises branch cloning options.
11 . ./test-lib.sh
13 test_expect_success \
14 'Create a Git commit' \
16 echo bar > bar.txt &&
17 stg add bar.txt &&
18 git commit -a -m bar
21 test_expect_success \
22 'Try to create a patch in a Git branch' \
24 command_error stg new p0 -m "p0"
27 test_expect_success \
28 'Clone the current Git branch' \
30 stg branch --clone foo &&
31 stg new p1 -m "p1" &&
32 test "$(stg series --applied -c)" -eq 1
35 test_expect_success \
36 'Clone the current StGit branch' \
38 stg branch --clone bar &&
39 test "$(stg series --applied -c)" -eq 1 &&
40 test "$(git config --get branch.bar.description)" = "clone of \"foo\"" &&
41 stg new p2 -m "p2" &&
42 test "$(stg series --applied -c)" -eq 2
45 test_expect_success \
46 'Anonymous clone' \
48 stg branch --clone &&
49 stg branch |
50 grep -E "^bar-[0-9]+-[0-9]+"
53 test_expect_success \
54 'Invalid clone args' \
56 command_error stg branch --clone bname extra
59 test_done