X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=diffcore-pathspec.c;h=139fe882f9f85575af297a2131cfac2888ae3c73;hb=42277bc81ce2f4450fe08239e4db34516f879c1d;hp=a48acbc965d5187fc9abb3ffab4fc9e60d4feac3;hpb=d59a6043a8a7aed97c684fb4f14fe5221df1fcaf;p=git.git diff --git a/diffcore-pathspec.c b/diffcore-pathspec.c index a48acbc9..139fe882 100644 --- a/diffcore-pathspec.c +++ b/diffcore-pathspec.c @@ -29,6 +29,8 @@ static int matches_pathspec(const char *name, struct path_spec *s, int cnt) name[len] == 0 || name[len] == '/') return 1; + if (!len) + return 1; } return 0; } @@ -46,6 +48,9 @@ void diffcore_pathspec(const char **pathspec) for (i = 0; pathspec[i]; i++) ; speccnt = i; + if (!speccnt) + return; + spec = xmalloc(sizeof(*spec) * speccnt); for (i = 0; pathspec[i]; i++) { spec[i].spec = pathspec[i];