dir.c: stop ignoring opendir() error in open_cached_dir()
A follow-up to the recently fixed bugs in the untracked invalidation. If opendir() fails it should show a warning, perhaps this should die, but if this ever happens the error is probably recoverable for the user, and dying would just make things worse. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
b640313110
commit
b673155074
7
dir.c
7
dir.c
@ -1787,11 +1787,16 @@ static int open_cached_dir(struct cached_dir *cdir,
|
|||||||
struct strbuf *path,
|
struct strbuf *path,
|
||||||
int check_only)
|
int check_only)
|
||||||
{
|
{
|
||||||
|
const char *c_path;
|
||||||
|
|
||||||
memset(cdir, 0, sizeof(*cdir));
|
memset(cdir, 0, sizeof(*cdir));
|
||||||
cdir->untracked = untracked;
|
cdir->untracked = untracked;
|
||||||
if (valid_cached_dir(dir, untracked, istate, path, check_only))
|
if (valid_cached_dir(dir, untracked, istate, path, check_only))
|
||||||
return 0;
|
return 0;
|
||||||
cdir->fdir = opendir(path->len ? path->buf : ".");
|
c_path = path->len ? path->buf : ".";
|
||||||
|
cdir->fdir = opendir(c_path);
|
||||||
|
if (!cdir->fdir)
|
||||||
|
warning_errno(_("could not open directory '%s'"), c_path);
|
||||||
if (dir->untracked) {
|
if (dir->untracked) {
|
||||||
invalidate_directory(dir->untracked, untracked);
|
invalidate_directory(dir->untracked, untracked);
|
||||||
dir->untracked->dir_opened++;
|
dir->untracked->dir_opened++;
|
||||||
|
Reference in New Issue
Block a user