pathspec: allow to ignore SKIP_WORKTREE entries on index matching
Add a new enum parameter to `add_pathspec_matches_against_index()` and `find_pathspecs_matching_against_index()`, allowing callers to specify whether these function should attempt to match SKIP_WORKTREE entries or not. This will be used in a future patch to make `git add` display a warning when it is asked to update SKIP_WORKTREE entries. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d73dbafc2c
commit
719630eb48
@ -177,7 +177,8 @@ static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec,
|
||||
*dst++ = entry;
|
||||
}
|
||||
dir->nr = dst - dir->entries;
|
||||
add_pathspec_matches_against_index(pathspec, &the_index, seen);
|
||||
add_pathspec_matches_against_index(pathspec, &the_index, seen,
|
||||
PS_HEED_SKIP_WORKTREE);
|
||||
return seen;
|
||||
}
|
||||
|
||||
@ -578,7 +579,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
|
||||
int i;
|
||||
|
||||
if (!seen)
|
||||
seen = find_pathspecs_matching_against_index(&pathspec, &the_index);
|
||||
seen = find_pathspecs_matching_against_index(&pathspec,
|
||||
&the_index, PS_HEED_SKIP_WORKTREE);
|
||||
|
||||
/*
|
||||
* file_exists() assumes exact match
|
||||
|
Reference in New Issue
Block a user