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>
This commit is contained in:

committed by
Junio C Hamano

parent
a64215b6cd
commit
ac48adf488
31
cache.h
31
cache.h
@ -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 */
|
||||
|
Reference in New Issue
Block a user