Browse Source

rerere: don't segfault on failure to open rr-cache

The rr-cache directory should always exist if we are doing
garbage collection (earlier code paths check this
explicitly), but we may not necessarily succeed in opening
it (for example, due to permissions problems). In that case,
we should print an error message rather than simply
segfaulting.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jeff King 15 years ago committed by Junio C Hamano
parent
commit
e5f591720c
  1. 2
      builtin-rerere.c

2
builtin-rerere.c

@ -48,6 +48,8 @@ static void garbage_collect(struct string_list *rr)


git_config(git_rerere_gc_config, NULL); git_config(git_rerere_gc_config, NULL);
dir = opendir(git_path("rr-cache")); dir = opendir(git_path("rr-cache"));
if (!dir)
die_errno("unable to open rr-cache directory");
while ((e = readdir(dir))) { while ((e = readdir(dir))) {
if (is_dot_or_dotdot(e->d_name)) if (is_dot_or_dotdot(e->d_name))
continue; continue;

Loading…
Cancel
Save