From b155725daeec48436d1fcbec4854ffd317408a6e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 25 Jun 2005 02:25:29 -0700 Subject: [PATCH] Fix oversimplified optimization for add_cache_entry(). An earlier change to optimize directory-file conflict check broke what "read-tree --emu23" expects. This is fixed by this commit. (1) Introduces an explicit flag to tell add_cache_entry() not to check for conflicts and use it when reading an existing tree into an empty stage --- by definition this case can never introduce such conflicts. (2) Makes read-cache.c:has_file_name() and read-cache.c:has_dir_name() aware of the cache stages, and flag conflict only with paths in the same stage. Signed-off-by: Junio C Hamano Signed-off-by: Linus Torvalds --- tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tree.c') diff --git a/tree.c b/tree.c index 2432f09a02..96f78f6a34 100644 --- a/tree.c +++ b/tree.c @@ -18,7 +18,7 @@ static int read_one_entry(unsigned char *sha1, const char *base, int baselen, co memcpy(ce->name, base, baselen); memcpy(ce->name + baselen, pathname, len+1); memcpy(ce->sha1, sha1, 20); - return add_cache_entry(ce, ADD_CACHE_OK_TO_ADD); + return add_cache_entry(ce, ADD_CACHE_OK_TO_ADD|ADD_CACHE_SKIP_DFCHECK); } static int read_tree_recursive(void *buffer, unsigned long size, -- cgit v1.2.3