[BUG/TEST 1/2] t3501: Expose bug with cherry-pick into dirty trees w/ renames

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

 



I encountered this bug while doing some cherry-picking into a
dirty tree. In this case, the working tree was dirty with some
changes to a file that had been renamed. The change I wanted to
cherry-pick was made along another branch before the rename and
it matched a subset of my working tree modulo the file rename.
When I cherry-picked the change from the other branch without the
rename to my current branch with the rename, the change applied
cleanly and the dirty bits were committed but the other dirty
bits in the file were lost. Make this into a test to expose this
bug.

Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
---
 t/t3501-revert-cherry-pick.sh | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 6f489e2..eef4d8c 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -109,4 +109,32 @@ test_expect_success 'chery-pick on unborn branch' '
 	! test_cmp_rev initial HEAD
 '
 
+test_expect_success 'cherry-pick on dirty rename should stay dirty' '
+	git checkout initial &&
+
+	for l in b c d e f g h i j k l m n o
+	do
+		echo $l$l$l$l$l$l$l$l$l
+	done >oops &&
+
+	test_tick &&
+	git add oops &&
+	git commit -m drop &&
+	git tag drop &&
+
+	git checkout initial &&
+	test_tick &&
+	git mv oops spoo &&
+	git commit -m rename3 &&
+	git tag rename3 &&
+
+	for l in b c d e f g h i j k m n o
+	do
+		echo $l$l$l$l$l$l$l$l$l
+	done >spoo &&
+
+	git cherry-pick drop &&
+	! git diff --quiet
+'
+
 test_done
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
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]