From: James Bottomley Date: Mon, 18 Apr 2005 18:44:31 +0000 (-0700) Subject: [PATCH] fix bug in read-cache.c which loses files when merging a tree X-Git-Tag: v0.99~834 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a4b7dbef4ef53f4fffbda0a6f5eada4c377e3fc5;p=git.git [PATCH] fix bug in read-cache.c which loses files when merging a tree I noticed this when I tried a non-trivial scsi merge and checked the results against BK. The problem is that remove_entry_at() actually decrements active_nr, so decrementing it in add_cache_entry() before calling remove_entry_at() is a double decrement (hence we lose cache entries at the end). --- diff --git a/read-cache.c b/read-cache.c index 042b0c210..8571ba2f0 100644 --- a/read-cache.c +++ b/read-cache.c @@ -402,7 +402,6 @@ int add_cache_entry(struct cache_entry *ce, int ok_to_add) if (pos < active_nr && ce_stage(ce) == 0) { while (same_name(active_cache[pos], ce)) { ok_to_add = 1; - active_nr--; if (!remove_entry_at(pos)) break; }