Test for generated patchname with trailing period
[stgit.git] / t / t2101-pull-policy-pull.sh
blobeb12991e86f848ea2c94559f6f7cb6b6e72c533d
1 #!/bin/sh
3 # Copyright (c) 2007 Yann Dirson
6 test_description='Excercise pull-policy "fetch-rebase".'
8 . ./test-lib.sh
10 # don't need this repo, but better not drop it, see t1100
11 #rm -rf .git
13 test_expect_success \
14 'Setup upstream repo, clone it, and add patches to the clone' \
16 test_create_repo upstream &&
17 (cd upstream && stg init) &&
18 stg clone upstream clone &&
19 (cd clone &&
20 git config pull.rebase false &&
21 git config branch.master.stgit.pull-policy pull &&
22 git config --list &&
23 stg new c1 -m c1 &&
24 echo a > file && stg add file && stg refresh
28 test_expect_success \
29 'Check protection' \
30 '(cd clone &&
31 stg branch --protect &&
32 command_error stg pull 2>&1 |
33 grep "This branch is protected" &&
34 stg branch --unprotect
38 test_expect_success \
39 'Add non-rewinding commit upstream and pull it from clone' \
41 (cd upstream && stg new u1 -m u1 &&
42 echo a > file2 && stg add file2 && stg refresh) &&
43 (cd clone && stg pull) &&
44 test_path_is_file clone/file2 &&
45 test_path_is_file clone/file
48 test_expect_success \
49 'Test too many arguments' \
52 cd clone &&
53 command_error stg pull origin master 2>&1 | \
54 grep "incorrect number of arguments"
58 test_expect_success \
59 'Test invalid pull policy' \
61 test_config -C clone branch.master.stgit.pull-policy bogus &&
63 cd clone &&
64 command_error stg pull 2>&1 | grep "Unsupported pull-policy"
68 # note: with pre-1.5 Git the clone is not automatically recorded
69 # as rewinding, and thus heads/origin is not moved, but the stack
70 # is still correctly rebased
72 test_expect_success \
73 'Rewind/rewrite upstream commit and pull it from clone, without --merged' \
76 cd upstream &&
77 echo b >> file2 &&
78 stg refresh
79 ) &&
81 cd clone &&
82 conflict stg pull origin
86 test_expect_success \
87 '"Solve" the conflict (pretend there is none)' \
88 '(cd clone &&
89 stg add file2 &&
90 EDITOR=cat git commit
94 test_expect_success \
95 'Push the stack back' \
96 '(cd clone && stg push -a)'
98 test_expect_success \
99 'Exercise stgit.keepoptimized' \
101 test_config -C clone stgit.keepoptimized true &&
103 cd clone &&
104 stg pull
108 test_done