Re: [PATCH 2/2] fast-import: Handle 'sub/testname' to 'sub/testname/testfile' renaming correctly

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

 



Judging from "git shortlog --since=6.months fast-import.c", Jonathan
may be the most qualified to see if this makes sense, among the
active list regulars, so....

-- >8 --
From: Techlive Zheng <techlivezheng@xxxxxxxxx>
Subject: [PATCH 2/2] fast-import: Handle 'sub/testname' to 'sub/testname/testfile' renaming correctly
Date: Thu,  9 Aug 2012 03:42:50 +0800

The current git-fast-import would not correctly handle such a commit stream
in which a file was deleted and at the same time a directory with the same
name was created. All paths under the newly created directory will be lost
after the importing.
---
 fast-import.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fast-import.c b/fast-import.c
index eed97c8..8874b4b 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1595,6 +1595,15 @@ static int tree_content_remove(
 				 * exist and need not be deleted.
 				 */
 				return 1;
+			if (!slash1 && S_ISREG(e->versions[0].mode) && S_ISDIR(e->versions[1].mode))
+			    /*
+			     * If p names a file in some subdirectory and in
+			     * some commit that file got deleted, a directory
+			     * with the same name was set up in the same directory,
+			     * then there is no need to step into for further
+			     * iteration or deletion.
+			     */
+				return 0;
 			if (!slash1 || !S_ISDIR(e->versions[1].mode))
 				goto del_entry;
 			if (!e->tree)
-- 
1.7.11.4

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