Thread (23 messages) flat view 23 messages, 5 authors, 2016-06-15
STALE3719d

Revision v1 of 3 in this series.

Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH 02/12] t4150: am fails if index is dirty

From: Paul Tan <hidden>
Date: 2016-06-15 23:05:38
Subsystem: the rest · Maintainer: Linus Torvalds

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am
will ensure that the index is clean before applying the patch. This is
to prevent changes unrelated to the patch from being committed.

Add a test for this check.

Cc: Junio C Hamano <redacted>
Signed-off-by: Paul Tan <redacted>
---
 t/t4150-am.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index 3f54bdf..0a19136 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -154,6 +154,17 @@ test_expect_success 'am applies patch correctly' '
 	test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
 '
 
+test_expect_success 'am fails if index is dirty' '
+	test_when_finished "rm -fr dirtyfile" &&
+	rm -fr .git/rebase-apply &&
+	git checkout -f first &&
+	echo dirtyfile >dirtyfile &&
+	git add dirtyfile &&
+	test_must_fail git am patch1 &&
+	test_path_is_dir .git/rebase-apply &&
+	test_cmp_rev first HEAD
+'
+
 test_expect_success 'am applies patch e-mail not in a mbox' '
 	rm -fr .git/rebase-apply &&
 	git reset --hard &&
-- 
2.5.0.rc1.81.gfe77482
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help