Subject: Re: git bug: moved file with local unstaged changes are lost during merge

From: Clemens Buchacher <[email-masked]>
Date: Sun, 15 Apr 2012 01:15:17 +0200

On Fri, Apr 13, 2012 at 02:49:41AM -0400, Jeff King wrote:
> 
> t6042 and t6036 detect some of them. But I thought we managed to clean
> up all of the overwriting bugs.

I could not find an existing test for this.

-->o--
Subject: [PATCH] merge overwrites unstaged changes in renamed file

Signed-off-by: Clemens Buchacher <[email-masked]>
---
 t/t7607-merge-overwrite.sh |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh
index aa74184..6547eb8 100755
--- a/t/t7607-merge-overwrite.sh
+++ b/t/t7607-merge-overwrite.sh
@@ -92,6 +92,15 @@ test_expect_success 'will not overwrite removed file with staged changes' '
 	test_cmp important c1.c
 '
 
+test_expect_failure 'will not overwrite unstaged changes in renamed file' '
+	git reset --hard c1 &&
+	git mv c1.c other.c &&
+	git commit -m rename &&
+	cp important other.c &&
+	git merge c1a &&
+	test_cmp important other.c
+'
+
 test_expect_success 'will not overwrite untracked subtree' '
 	git reset --hard c0 &&
 	rm -rf sub &&
-- 
1.7.9.6