git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 4/6] builtin/add.c: use path_excluded()
Date: Tue,  5 Jun 2012 22:45:17 -0700	[thread overview]
Message-ID: <1338961519-30970-5-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1338961519-30970-1-git-send-email-gitster@pobox.com>

This only happens in --ignore-missing --dry-run codepath which
presumably nobody should care, but is for completeness.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin/add.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/builtin/add.c b/builtin/add.c
index c59b0c9..e5b40d9 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -441,6 +441,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 
 	if (pathspec) {
 		int i;
+		struct path_exclude_check check;
+
+		path_exclude_check_init(&check, &dir);
 		if (!seen)
 			seen = find_used_pathspec(pathspec);
 		for (i = 0; pathspec[i]; i++) {
@@ -448,7 +451,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 			    && !file_exists(pathspec[i])) {
 				if (ignore_missing) {
 					int dtype = DT_UNKNOWN;
-					if (excluded(&dir, pathspec[i], &dtype))
+					if (path_excluded(&check, pathspec[i], -1, &dtype))
 						dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
 				} else
 					die(_("pathspec '%s' did not match any files"),
@@ -456,6 +459,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 			}
 		}
 		free(seen);
+		path_exclude_check_clear(&check);
 	}
 
 	exit_status |= add_files_to_cache(prefix, pathspec, flags);
-- 
1.7.11.rc1.37.g09843ac

  parent reply	other threads:[~2012-06-06  5:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06  5:45 [PATCH 0/6] "ls-files -i" not honoring directory wide ignore Junio C Hamano
2012-06-06  5:45 ` [PATCH 1/6] ls-files -i: pay attention to exclusion of leading paths Junio C Hamano
2012-06-06  5:45 ` [PATCH 2/6] ls-files -i: micro-optimize path_excluded() Junio C Hamano
2012-06-06  5:45 ` [PATCH 3/6] path_excluded(): update API to less cache-entry centric Junio C Hamano
2012-06-06  5:45 ` Junio C Hamano [this message]
2012-06-06  5:45 ` [PATCH 5/6] unpack-trees.c: use path_excluded() in check_ok_to_remove() Junio C Hamano
2012-06-06  5:45 ` [PATCH 6/6] dir.c: make excluded() file scope static Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338961519-30970-5-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).