2 * Copyright (C) 2005 Junio C Hamano
13 static int matches_pathspec(const char *name
, struct path_spec
*s
, int cnt
)
21 namelen
= strlen(name
);
22 for (i
= 0; i
< cnt
; i
++) {
26 if (memcmp(s
[i
].spec
, name
, len
))
28 if (s
[i
].spec
[len
-1] == '/' ||
36 void diffcore_pathspec(const char **pathspec
)
38 struct diff_queue_struct
*q
= &diff_queued_diff
;
40 struct diff_queue_struct outq
;
41 struct path_spec
*spec
;
44 outq
.nr
= outq
.alloc
= 0;
46 for (i
= 0; pathspec
[i
]; i
++)
49 spec
= xmalloc(sizeof(*spec
) * speccnt
);
50 for (i
= 0; pathspec
[i
]; i
++) {
51 spec
[i
].spec
= pathspec
[i
];
52 spec
[i
].len
= strlen(pathspec
[i
]);
55 for (i
= 0; i
< q
->nr
; i
++) {
56 struct diff_filepair
*p
= q
->queue
[i
];
57 if (matches_pathspec(p
->two
->path
, spec
, speccnt
))
60 diff_free_filepair(p
);