Skip to content

Commit

Permalink
t4151: am --abort will keep dirty index intact
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Tan authored and Junio C Hamano committed Jul 20, 2015
1 parent ab15612 commit 528484c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions t/t4151-am-abort.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 528484c

Please sign in to comment.