From d616813d75b888b7c29bbad19808fe5cffa5380c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 11 Aug 2007 23:59:01 +0200 Subject: git-add: Add support for --refresh option. This allows to refresh only a subset of the project files, based on the specified pathspecs. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano --- read-cache.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'read-cache.c') diff --git a/read-cache.c b/read-cache.c index 865369df0e..8b1c94e0e3 100644 --- a/read-cache.c +++ b/read-cache.c @@ -7,6 +7,7 @@ #include "cache.h" #include "cache-tree.h" #include "refs.h" +#include "dir.h" /* Index extensions. * @@ -798,7 +799,7 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate, return updated; } -int refresh_index(struct index_state *istate, unsigned int flags) +int refresh_index(struct index_state *istate, unsigned int flags, const char **pathspec, char *seen) { int i; int has_errors = 0; @@ -824,6 +825,9 @@ int refresh_index(struct index_state *istate, unsigned int flags) continue; } + if (pathspec && !match_pathspec(pathspec, ce->name, strlen(ce->name), 0, seen)) + continue; + new = refresh_cache_ent(istate, ce, really, &cache_errno); if (new == ce) continue; -- cgit v1.2.1