Skip to content

Commit

Permalink
dir.c: make last_exclude_matching_from_list() run til the end
Browse files Browse the repository at this point in the history
The next patch adds some post processing to the result value before it's
returned to the caller. Keep all branches reach the end of the function,
so we can do it all in one place.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Sep 21, 2015
1 parent ecad27c commit e6efecc
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
int *dtype,
struct exclude_list *el)
{
struct exclude *exc = NULL; /* undecided */
int i;

if (!el->nr)
Expand All @@ -773,18 +774,22 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
if (match_basename(basename,
pathlen - (basename - pathname),
exclude, prefix, x->patternlen,
x->flags))
return x;
x->flags)) {
exc = x;
break;
}
continue;
}

assert(x->baselen == 0 || x->base[x->baselen - 1] == '/');
if (match_pathname(pathname, pathlen,
x->base, x->baselen ? x->baselen - 1 : 0,
exclude, prefix, x->patternlen, x->flags))
return x;
exclude, prefix, x->patternlen, x->flags)) {
exc = x;
break;
}
}
return NULL; /* undecided */
return exc;
}

/*
Expand Down

0 comments on commit e6efecc

Please sign in to comment.