git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Clemens Buchacher <drizzd@aon.at>
Date
Apr 14, 2012, 23:15 UTC
Message-ID
<20120414231515.GB18137@ecki>
In-Reply-To
<20120413064941.GC27214@sigill.intra.peff.net>
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 <drizzd@aon.at>
---
 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
Previous: Jeff KingNext: Clemens Buchacher
Message 4 of 6 in “git bug: moved file with local unstaged changes are lost during merge”
  1. Joe AngellApr 11, 2012
  2. Joe AngellApr 12, 2012
  3. Jeff KingApr 13, 2012
  4. Clemens BuchacherApr 14, 2012
  5. Clemens BuchacherApr 29, 2012
  6. Junio C HamanoApr 30, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.