summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index 21f6e8e4d5..03d49e1026 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -369,7 +369,9 @@ static int remove_entry_at(int pos)
int remove_file_from_cache(char *path)
{
int pos = cache_name_pos(path, strlen(path));
- if (pos >= 0)
+ if (pos < 0)
+ pos = -pos-1;
+ while (pos < active_nr && !strcmp(active_cache[pos]->name, path))
remove_entry_at(pos);
return 0;
}