Skip to content

Commit 528484c

Browse files
pyokagangitster
authored andcommitted
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>
1 parent ab15612 commit 528484c

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

t/t4151-am-abort.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,21 @@ test_expect_success 'am --abort will keep the local commits intact' '
9595
test_cmp expect actual
9696
'
9797

98+
test_expect_success 'am --abort will keep dirty index intact' '
99+
git reset --hard initial &&
100+
echo dirtyfile >dirtyfile &&
101+
cp dirtyfile dirtyfile.expected &&
102+
git add dirtyfile &&
103+
test_must_fail git am 0001-*.patch &&
104+
test_cmp_rev initial HEAD &&
105+
test_path_is_file dirtyfile &&
106+
test_cmp dirtyfile.expected dirtyfile &&
107+
git am --abort &&
108+
test_cmp_rev initial HEAD &&
109+
test_path_is_file dirtyfile &&
110+
test_cmp dirtyfile.expected dirtyfile
111+
'
112+
98113
test_expect_success 'am -3 stops on conflict on unborn branch' '
99114
git checkout -f --orphan orphan &&
100115
git reset &&

0 commit comments

Comments
 (0)