]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4257-am-interactive.sh
The seventh batch
[thirdparty/git.git] / t / t4257-am-interactive.sh
CommitLineData
7663e438
JK
1#!/bin/sh
2
3test_description='am --interactive tests'
b2e5d75d
ÆAB
4
5TEST_PASSES_SANITIZE_LEAK=true
7663e438
JK
6. ./test-lib.sh
7
8test_expect_success 'set up patches to apply' '
9 test_commit unrelated &&
10 test_commit no-conflict &&
11 test_commit conflict-patch file patch &&
12 git format-patch --stdout -2 >mbox &&
13
14 git reset --hard unrelated &&
8f37854b 15 test_commit conflict-main file main base
7663e438
JK
16'
17
18# Sanity check our setup.
19test_expect_success 'applying all patches generates conflict' '
20 test_must_fail git am mbox &&
21 echo resolved >file &&
22 git add -u &&
23 git am --resolved
24'
25
26test_expect_success 'interactive am can apply a single patch' '
27 git reset --hard base &&
28 # apply the first, but not the second
29 test_write_lines y n | git am -i mbox &&
30
31 echo no-conflict >expect &&
32 git log -1 --format=%s >actual &&
33 test_cmp expect actual
34'
35
36test_expect_success 'interactive am can resolve conflict' '
37 git reset --hard base &&
38 # apply both; the second one will conflict
39 test_write_lines y y | test_must_fail git am -i mbox &&
40 echo resolved >file &&
41 git add -u &&
42 # interactive "--resolved" will ask us if we want to apply the result
43 echo y | git am -i --resolved &&
44
45 echo conflict-patch >expect &&
46 git log -1 --format=%s >actual &&
47 test_cmp expect actual &&
48
49 echo resolved >expect &&
50 git cat-file blob HEAD:file >actual &&
51 test_cmp expect actual
52'
53
54test_done