From 0188f6b3c191eb5277e9ebab3b9079f923dbd283 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Thu, 11 Nov 2010 20:03:22 +0700 Subject: [PATCH] add: do not rely on dtype being NULL behavior MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Commit c84de70 (excluded_1(): support exclude files in index - 2009-08-20) added support for excluded() where dtype can be NULL. It was designed specifically for index matching because there was no other way to extract dtype information from index. It did not support wildcard matching (for example, "a*/" pattern would fail to match). The code was probably misread when commit 108da0d (git add: Add the "--ignore-missing" option for the dry run - 2010-07-10) was made because DT_UNKNOWN happens to be zero (NULL) too. Do not pass DT_UNKNOWN/NULL to excluded(), instead pass a pointer to a variable that contains DT_UNKNOWN. The real dtype will be extracted from worktree by excluded(), as expected. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/add.c b/builtin/add.c index 56a4e0af6..1a4672d12 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -446,7 +446,8 @@ int cmd_add(int argc, const char **argv, const char *prefix) if (!seen[i] && pathspec[i][0] && !file_exists(pathspec[i])) { if (ignore_missing) { - if (excluded(&dir, pathspec[i], DT_UNKNOWN)) + int dtype = DT_UNKNOWN; + if (excluded(&dir, pathspec[i], &dtype)) dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i])); } else die("pathspec '%s' did not match any files", -- 2.30.2