[PATCH 6/9] cherry-pick: add tests for new --ff option

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christian Couder
Date: Friday, February 5, 2010 - 4:11 pm

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 t/t3506-cherry-pick-ff.sh |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100755 t/t3506-cherry-pick-ff.sh

diff --git a/t/t3506-cherry-pick-ff.sh b/t/t3506-cherry-pick-ff.sh
new file mode 100755
index 0000000..21c0729
--- /dev/null
+++ b/t/t3506-cherry-pick-ff.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+test_description='test cherry-picking with --ff option'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+	echo first > file1 &&
+	git add file1 &&
+	test_tick &&
+	git commit -m "first" &&
+	git tag first &&
+
+	git checkout -b other &&
+	echo second >> file1 &&
+	git add file1 &&
+	test_tick &&
+	git commit -m "second" &&
+	git tag second
+'
+
+test_expect_success 'cherry-pick using --ff fast forwards' '
+	git checkout master &&
+	git reset --hard first &&
+	test_tick &&
+	git cherry-pick --ff second &&
+	test "$(git rev-parse --verify HEAD)" = "$(git rev-parse --verify second)"
+'
+
+test_expect_success 'cherry-pick not using --ff does not fast forwards' '
+	git checkout master &&
+	git reset --hard first &&
+	test_tick &&
+	git cherry-pick second &&
+	test "$(git rev-parse --verify HEAD)" != "$(git rev-parse --verify second)"
+'
+
+test_done
-- 
1.6.6.1.557.g77031


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/9] add --ff option to cherry-pick, Christian Couder, (Fri Feb 5, 4:11 pm)
[PATCH 3/9] reset: refactor reseting in its own function, Christian Couder, (Fri Feb 5, 4:11 pm)
[PATCH 6/9] cherry-pick: add tests for new --ff option, Christian Couder, (Fri Feb 5, 4:11 pm)
[PATCH 8/9] rebase -i: use new --ff cherry-pick option, Christian Couder, (Fri Feb 5, 4:11 pm)
Re: [PATCH 0/9] add --ff option to cherry-pick, Junio C Hamano, (Fri Feb 5, 4:45 pm)
Re: [PATCH 0/9] add --ff option to cherry-pick, Christian Couder, (Sat Feb 6, 8:27 am)