use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t4257-am-interactive.sh
blob5344bd248a186e8bfccc29d02bcca96d13b9d42b
1 #!/bin/sh
3 test_description='am --interactive tests'
4 . ./test-lib.sh
6 test_expect_success 'set up patches to apply' '
7 test_commit unrelated &&
8 test_commit no-conflict &&
9 test_commit conflict-patch file patch &&
10 git format-patch --stdout -2 >mbox &&
12 git reset --hard unrelated &&
13 test_commit conflict-master file master base
16 # Sanity check our setup.
17 test_expect_success 'applying all patches generates conflict' '
18 test_must_fail git am mbox &&
19 echo resolved >file &&
20 git add -u &&
21 git am --resolved
24 test_expect_success 'interactive am can apply a single patch' '
25 git reset --hard base &&
26 # apply the first, but not the second
27 test_write_lines y n | git am -i mbox &&
29 echo no-conflict >expect &&
30 git log -1 --format=%s >actual &&
31 test_cmp expect actual
34 test_expect_success 'interactive am can resolve conflict' '
35 git reset --hard base &&
36 # apply both; the second one will conflict
37 test_write_lines y y | test_must_fail git am -i mbox &&
38 echo resolved >file &&
39 git add -u &&
40 # interactive "--resolved" will ask us if we want to apply the result
41 echo y | git am -i --resolved &&
43 echo conflict-patch >expect &&
44 git log -1 --format=%s >actual &&
45 test_cmp expect actual &&
47 echo resolved >expect &&
48 git cat-file blob HEAD:file >actual &&
49 test_cmp expect actual
52 test_done