Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-07-26 00:27:09 +0300
committerJunio C Hamano <gitster@pobox.com>2019-07-26 00:27:09 +0300
commit5bbbd576f5f9048200324424726daf4cc004ab3a (patch)
treec05acac3a6b817119697f3b6ad735ecedcce7b4a /t
parent5ca0db3fcaa46cdaa06268727a10abc438cc4af3 (diff)
parent7663e438c5ca5a1dbcfcb1a9cbf68480362998a2 (diff)
Merge branch 'jk/am-i-resolved-fix' into maint
"git am -i --resolved" segfaulted after trying to see a commit as if it were a tree, which has been corrected. * jk/am-i-resolved-fix: am: fix --interactive HEAD tree resolution am: drop tty requirement for --interactive am: read interactive input from stdin am: simplify prompt response handling
Diffstat (limited to 't')
-rwxr-xr-xt/t4257-am-interactive.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/t/t4257-am-interactive.sh b/t/t4257-am-interactive.sh
new file mode 100755
index 0000000000..5344bd248a
--- /dev/null
+++ b/t/t4257-am-interactive.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+test_description='am --interactive tests'
+. ./test-lib.sh
+
+test_expect_success 'set up patches to apply' '
+ test_commit unrelated &&
+ test_commit no-conflict &&
+ test_commit conflict-patch file patch &&
+ git format-patch --stdout -2 >mbox &&
+
+ git reset --hard unrelated &&
+ test_commit conflict-master file master base
+'
+
+# Sanity check our setup.
+test_expect_success 'applying all patches generates conflict' '
+ test_must_fail git am mbox &&
+ echo resolved >file &&
+ git add -u &&
+ git am --resolved
+'
+
+test_expect_success 'interactive am can apply a single patch' '
+ git reset --hard base &&
+ # apply the first, but not the second
+ test_write_lines y n | git am -i mbox &&
+
+ echo no-conflict >expect &&
+ git log -1 --format=%s >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'interactive am can resolve conflict' '
+ git reset --hard base &&
+ # apply both; the second one will conflict
+ test_write_lines y y | test_must_fail git am -i mbox &&
+ echo resolved >file &&
+ git add -u &&
+ # interactive "--resolved" will ask us if we want to apply the result
+ echo y | git am -i --resolved &&
+
+ echo conflict-patch >expect &&
+ git log -1 --format=%s >actual &&
+ test_cmp expect actual &&
+
+ echo resolved >expect &&
+ git cat-file blob HEAD:file >actual &&
+ test_cmp expect actual
+'
+
+test_done