From: Paul Tan Date: Sun, 19 Jul 2015 15:49:09 GMT Subject: [PATCH v3 03/12] t4151: am --abort will keep dirty index intact Message-ID: <1437320958-11192-4-git-send-email-pyokagan@gmail.com> In-Reply-To: <1437320958-11192-1-git-send-email-pyokagan@gmail.com> 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 Reviewed-by: Johannes Schindelin Signed-off-by: Paul Tan --- t/t4151-am-abort.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 && -- 2.5.0.rc2.110.gf2a5fc6