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:
Nguyễn Thái Ngọc Duy
2013-07-14 15:35:36 +07:00
committed by Junio C Hamano
parent dad2586a6b
commit 8f4f8f4579
6 changed files with 51 additions and 0 deletions

View File

@ -367,6 +367,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
}
}
if (rev.prune_data.nr) {
/* builtin_diff_b_f() */
GUARD_PATHSPEC(&rev.prune_data, PATHSPEC_FROMTOP);
if (!path)
path = rev.prune_data.items[0].match;
paths += rev.prune_data.nr;