diff options
author | Elijah Newren <newren@gmail.com> | 2023-02-24 00:09:31 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-02-23 17:25:29 -0800 |
commit | ac48adf488794417b1060b5ed2377a9fd4c33c17 (patch) | |
tree | 58d3b2d06a41d521ad5b50cfc872aa703a8e2d94 /cache.h | |
parent | a64215b6cd5e67939187475c5b248dc5d13e3d60 (diff) | |
download | git-ac48adf488794417b1060b5ed2377a9fd4c33c17.tar.gz |
dir.h: refactor to no longer need to include cache.h
Moving a few functions around allows us to make dir.h no longer need to
include cache.h. This commit is best viewed with:
git log -1 -p --color-moved
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r-- | cache.h | 31 |
1 files changed, 11 insertions, 20 deletions
@@ -14,9 +14,11 @@ #include "pack-revindex.h" #include "hash.h" #include "path.h" +#include "pathspec.h" #include "object.h" #include "oid-array.h" #include "repository.h" +#include "statinfo.h" #include "mem-pool.h" typedef struct git_zstream { @@ -119,26 +121,6 @@ struct cache_header { #define INDEX_FORMAT_LB 2 #define INDEX_FORMAT_UB 4 -/* - * The "cache_time" is just the low 32 bits of the - * time. It doesn't matter if it overflows - we only - * check it for equality in the 32 bits we save. - */ -struct cache_time { - uint32_t sec; - uint32_t nsec; -}; - -struct stat_data { - struct cache_time sd_ctime; - struct cache_time sd_mtime; - unsigned int sd_dev; - unsigned int sd_ino; - unsigned int sd_uid; - unsigned int sd_gid; - unsigned int sd_size; -}; - struct cache_entry { struct hashmap_entry ent; struct stat_data ce_stat_data; @@ -294,6 +276,15 @@ static inline unsigned int canon_mode(unsigned int mode) return S_IFGITLINK; } +static inline int ce_path_match(struct index_state *istate, + const struct cache_entry *ce, + const struct pathspec *pathspec, + char *seen) +{ + return match_pathspec(istate, pathspec, ce->name, ce_namelen(ce), 0, seen, + S_ISDIR(ce->ce_mode) || S_ISGITLINK(ce->ce_mode)); +} + #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1) #define SOMETHING_CHANGED (1 << 0) /* unclassified changes go here */ |