mirror of
https://github.com/git/git.git
synced 2026-04-12 01:40:10 +02:00
guard against new pathspec magic in pathspec matching code
GUARD_PATHSPEC() marks pathspec-sensitive code, basically all those that touch anything in 'struct pathspec' except fields "nr" and "original". GUARD_PATHSPEC() is not supposed to fail. It's mainly to help the designers catch unsupported codepaths. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
dad2586a6b
commit
8f4f8f4579
19
tree-diff.c
19
tree-diff.c
@@ -198,6 +198,25 @@ static void try_to_follow_renames(struct tree_desc *t1, struct tree_desc *t2, co
|
||||
const char *paths[1];
|
||||
int i;
|
||||
|
||||
/*
|
||||
* follow-rename code is very specific, we need exactly one
|
||||
* path. Magic that matches more than one path is not
|
||||
* supported.
|
||||
*/
|
||||
GUARD_PATHSPEC(&opt->pathspec, PATHSPEC_FROMTOP);
|
||||
#if 0
|
||||
/*
|
||||
* We should reject wildcards as well. Unfortunately we
|
||||
* haven't got a reliable way to detect that 'foo\*bar' in
|
||||
* fact has no wildcards. nowildcard_len is merely a hint for
|
||||
* optimization. Let it slip for now until wildmatch is taught
|
||||
* about dry-run mode and returns wildcard info.
|
||||
*/
|
||||
if (opt->pathspec.has_wildcard)
|
||||
die("BUG:%s:%d: wildcards are not supported",
|
||||
__FILE__, __LINE__);
|
||||
#endif
|
||||
|
||||
/* Remove the file creation entry from the diff queue, and remember it */
|
||||
choice = q->queue[0];
|
||||
q->nr = 0;
|
||||
|
||||
Reference in New Issue
Block a user