[PATCH v2 1/2] t5520-pull: Simplify --rebase with dirty tree test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Simplify the test case for testing git aborts the pull --rebase when the
work tree is dirty.

Signed-off-by: Kevin Daudt <me@xxxxxxxxx>
Helped-by: Paul Tan <pyokagan@xxxxxxxxx>
---
This is a preparation for the next pathch.

Changes since v1:
- Moved the tests just belof the first --rebase test
- Simplified both tests to only test if the rebase either succeded for
  failed


 t/t5520-pull.sh | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index 7efd45b..925ad49 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -122,6 +122,19 @@ test_expect_success '--rebase' '
 	test $(git rev-parse HEAD^) = $(git rev-parse copy) &&
 	test new = $(git show HEAD:file2)
 '
+
+test_expect_success 'pull --rebase dies early with dirty working directory' '
+	git reset --hard before-rebase &&
+	before=$(git rev-parse --verify before-rebase) &&
+	test_config branch.to-rebase.rebase true &&
+	echo dirty >>file &&
+	cp file expect &&
+	git add file &&
+	test_must_fail git pull . copy &&
+	test $(git rev-parse --verify to-rebase) = $before &&
+	test_cmp file expect
+'
+
 test_expect_success 'pull.rebase' '
 	git reset --hard before-rebase &&
 	test_config pull.rebase true &&
@@ -278,25 +291,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '
 
 '
 
-test_expect_success 'pull --rebase dies early with dirty working directory' '
-
-	git checkout to-rebase &&
-	git update-ref refs/remotes/me/copy copy^ &&
-	COPY=$(git rev-parse --verify me/copy) &&
-	git rebase --onto $COPY copy &&
-	test_config branch.to-rebase.remote me &&
-	test_config branch.to-rebase.merge refs/heads/copy &&
-	test_config branch.to-rebase.rebase true &&
-	echo dirty >> file &&
-	git add file &&
-	test_must_fail git pull &&
-	test $COPY = $(git rev-parse --verify me/copy) &&
-	git checkout HEAD -- file &&
-	git pull &&
-	test $COPY != $(git rev-parse --verify me/copy)
-
-'
-
 test_expect_success 'pull --rebase works on branch yet to be born' '
 	git rev-parse master >expect &&
 	mkdir empty_repo &&
-- 
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]