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>
This commit is contained in:
Alexandre Julliard
2007-08-11 23:59:01 +02:00
committed by Junio C Hamano
parent 77b258f436
commit d616813d75
5 changed files with 51 additions and 5 deletions

View File

@ -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;