2 * Copyright (C) 2005 Junio C Hamano
14 static int matches_pathspec(const char *name, struct path_spec *s, int cnt)
22 namelen = strlen(name);
23 for (i = 0; i < cnt; i++) {
25 if (! strncmp(s[i].spec, name, len) &&
27 (name[len] == 0 || name[len] == '/'))
33 void diffcore_pathspec(const char **pathspec)
35 struct diff_queue_struct *q = &diff_queued_diff;
37 struct diff_queue_struct outq;
38 struct path_spec *spec;
41 outq.nr = outq.alloc = 0;
43 for (i = 0; pathspec[i]; i++)
46 spec = xmalloc(sizeof(*spec) * speccnt);
47 for (i = 0; pathspec[i]; i++) {
48 spec[i].spec = pathspec[i];
49 spec[i].len = strlen(pathspec[i]);
52 for (i = 0; i < q->nr; i++) {
53 struct diff_filepair *p = q->queue[i];
54 if (matches_pathspec(p->one->path, spec, speccnt) ||
55 matches_pathspec(p->two->path, spec, speccnt))