diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-16 17:57:06 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-16 17:57:06 -0800 |
commit | 987e315a6b5a5dd224602f09b9dc7c0fe9c7d024 (patch) | |
tree | ce10af22609413c4316e12335387bcfa0ef1bf9b /cache.h | |
parent | 1ae419cb3902e6cc45538a9673539ed5316fcf30 (diff) | |
parent | 6831a88ac03759a8133f10ffd52ad235a081a8a3 (diff) | |
download | git-987e315a6b5a5dd224602f09b9dc7c0fe9c7d024.tar.gz |
Merge branch 'jc/gitignore-ends-with-slash'
* jc/gitignore-ends-with-slash:
gitignore: lazily find dtype
gitignore(5): Allow "foo/" in ignore list to match directory "foo"
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -178,6 +178,18 @@ static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned in } return create_ce_mode(mode); } +static inline int ce_to_dtype(const struct cache_entry *ce) +{ + unsigned ce_mode = ntohl(ce->ce_mode); + if (S_ISREG(ce_mode)) + return DT_REG; + else if (S_ISDIR(ce_mode) || S_ISGITLINK(ce_mode)) + return DT_DIR; + else if (S_ISLNK(ce_mode)) + return DT_LNK; + else + return DT_UNKNOWN; +} #define canon_mode(mode) \ (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \ S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK) |