summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorAlexandre Julliard <julliard@winehq.org>2007-08-11 21:59:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-08-13 19:58:38 (GMT)
commitd616813d75b888b7c29bbad19808fe5cffa5380c (patch)
tree822ae0e97f9ae00643bf9aee04f29af684bbd2a1 /read-cache.c
parent77b258f436874bdd1caecd4b3c9c63e3d49bd147 (diff)
downloadgit-d616813d75b888b7c29bbad19808fe5cffa5380c.zip
git-d616813d75b888b7c29bbad19808fe5cffa5380c.tar.gz
git-d616813d75b888b7c29bbad19808fe5cffa5380c.tar.bz2
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 <julliard@winehq.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index 865369d..8b1c94e 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;