diff options
-rw-r--r-- | read-cache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c index 21f6e8e4d..03d49e102 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; } |