Skip to content

Commit a4b7dbe

Browse files
James BottomleyLinus Torvalds
authored andcommitted
[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).
1 parent 1bc992a commit a4b7dbe

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

read-cache.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ int add_cache_entry(struct cache_entry *ce, int ok_to_add)
402402
if (pos < active_nr && ce_stage(ce) == 0) {
403403
while (same_name(active_cache[pos], ce)) {
404404
ok_to_add = 1;
405-
active_nr--;
406405
if (!remove_entry_at(pos))
407406
break;
408407
}

0 commit comments

Comments
 (0)