summaryrefslogtreecommitdiff
path: root/t/t4151-am-abort.sh
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2015-07-19 15:49:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-07-20 17:51:18 (GMT)
commit528484c6450877ecf3eaa09ed7eb2c583c75f378 (patch)
treeff9d5c6b48b9288a9f2d75019215af82c601717f /t/t4151-am-abort.sh
parentab156128fa0e3fc70a40f367abdf3f601c3ba611 (diff)
downloadgit-528484c6450877ecf3eaa09ed7eb2c583c75f378.zip
git-528484c6450877ecf3eaa09ed7eb2c583c75f378.tar.gz
git-528484c6450877ecf3eaa09ed7eb2c583c75f378.tar.bz2
t4151: am --abort will keep dirty index intact
Since 7b3b7e3 (am --abort: keep unrelated commits since the last failure and warn, 2010-12-21), git-am --abort will not touch the index if on the previous invocation, git-am failed because the index is dirty. This is to ensure that the user's modifications to the index are not discarded. Add a test for this. Reviewed-by: Stefan Beller <sbeller@google.com> Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4151-am-abort.sh')
-rwxr-xr-xt/t4151-am-abort.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/t/t4151-am-abort.sh b/t/t4151-am-abort.sh
index 833e7b2..05bdc3e 100755
--- a/t/t4151-am-abort.sh
+++ b/t/t4151-am-abort.sh
@@ -95,6 +95,21 @@ test_expect_success 'am --abort will keep the local commits intact' '
test_cmp expect actual
'
+test_expect_success 'am --abort will keep dirty index intact' '
+ git reset --hard initial &&
+ echo dirtyfile >dirtyfile &&
+ cp dirtyfile dirtyfile.expected &&
+ git add dirtyfile &&
+ test_must_fail git am 0001-*.patch &&
+ test_cmp_rev initial HEAD &&
+ test_path_is_file dirtyfile &&
+ test_cmp dirtyfile.expected dirtyfile &&
+ git am --abort &&
+ test_cmp_rev initial HEAD &&
+ test_path_is_file dirtyfile &&
+ test_cmp dirtyfile.expected dirtyfile
+'
+
test_expect_success 'am -3 stops on conflict on unborn branch' '
git checkout -f --orphan orphan &&
git reset &&