summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-01-31 20:23:25 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-05 00:46:49 -0800
commit6831a88ac03759a8133f10ffd52ad235a081a8a3 (patch)
tree1f9dcec12142df59bcaff2200349fbef78ee4100 /unpack-trees.c
parentd6b8fc303b389b026f2bf9918f6f83041488989b (diff)
downloadgit-6831a88ac03759a8133f10ffd52ad235a081a8a3.tar.gz
gitignore: lazily find dtype
When we process "foo/" entries in gitignore files on a system that does not have d_type member in "struct dirent", the earlier implementation ran lstat(2) separately when matching with entries that came from the command line, in-tree .gitignore files, and $GIT_DIR/info/excludes file. This optimizes it by delaying the lstat(2) call until it becomes absolutely necessary. The initial idea for this change was by Jeff King, but I optimized it further to pass pointers to around. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index 11af2636c2..29848e926c 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -522,8 +522,9 @@ static void verify_absent(struct cache_entry *ce, const char *action,
if (!lstat(ce->name, &st)) {
int cnt;
+ int dtype = ce_to_dtype(ce);
- if (o->dir && excluded(o->dir, ce->name, ce_to_dtype(ce)))
+ if (o->dir && excluded(o->dir, ce->name, &dtype))
/*
* ce->name is explicitly excluded, so it is Ok to
* overwrite it.