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>
Paul Tan committed
Jul 19, 2015 at 23:49 UTC
528484c6450877ecf3eaa09ed7eb2c583c75f378
1 file changed
+15
t/t4151-am-abort.sh
+15
@@ -95,6 +95,21 @@ test_expect_success 'am --abort will keep the local commits intact' '
95
test_cmp expect actual
96
'
97
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
+
113
test_expect_success 'am -3 stops on conflict on unborn branch' '
114
git checkout -f --orphan orphan &&
115
git reset &&