]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4257-am-interactive.sh
hashmap: use *_entry APIs for iteration
[thirdparty/git.git] / t / t4257-am-interactive.sh
CommitLineData
7663e438
JK
1#!/bin/sh
2
3test_description='am --interactive tests'
4. ./test-lib.sh
5
6test_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 &&
11
12 git reset --hard unrelated &&
13 test_commit conflict-master file master base
14'
15
16# Sanity check our setup.
17test_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
22'
23
24test_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 &&
28
29 echo no-conflict >expect &&
30 git log -1 --format=%s >actual &&
31 test_cmp expect actual
32'
33
34test_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 &&
42
43 echo conflict-patch >expect &&
44 git log -1 --format=%s >actual &&
45 test_cmp expect actual &&
46
47 echo resolved >expect &&
48 git cat-file blob HEAD:file >actual &&
49 test_cmp expect actual
50'
51
52test_done