dir.c: make last_exclude_matching_from_list() run til the end

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>

Nguyễn Thái Ngọc Duy committed Sep 21, 2015 at 16:56 UTC e6efecc46a34a984535e6a90e45a9db45af4eff2
1 file changed +10 -5
dir.c
+10 -5
@@ -752,6 +752,7 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
752 int *dtype,
753 struct exclude_list *el)
754 {
755 + struct exclude *exc = NULL; /* undecided */
756 int i;
757
758 if (!el->nr)
@@ -773,18 +774,22 @@ static struct exclude *last_exclude_matching_from_list(const char *pathname,
774 if (match_basename(basename,
775 pathlen - (basename - pathname),
776 exclude, prefix, x->patternlen,
776 - x->flags))
777 - return x;
777 + x->flags)) {
778 + exc = x;
779 + break;
780 + }
781 continue;
782 }
783
784 assert(x->baselen == 0 || x->base[x->baselen - 1] == '/');
785 if (match_pathname(pathname, pathlen,
786 x->base, x->baselen ? x->baselen - 1 : 0,
784 - exclude, prefix, x->patternlen, x->flags))
785 - return x;
787 + exclude, prefix, x->patternlen, x->flags)) {
788 + exc = x;
789 + break;
790 + }
791 }
787 - return NULL; /* undecided */
792 + return exc;
793 }
794
795 /*