summaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-04-16 08:33:23 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 08:33:23 -0700
commitaee461985f52857fa04999b2a988986dd8c84aba (patch)
treeb474d669fad6d037c18c0d232aef579a65ae101b /cache.h
parentfcf712e60e3221a7971cb2ad89e61c565172f524 (diff)
downloadgit-aee461985f52857fa04999b2a988986dd8c84aba.tar.gz
[PATCH] Add --stage to show-files for new stage dircache.
This adds --stage option to show-files command. It shows file-mode, SHA1, stage and pathname. Record separator follows the usual convention of -z option as before. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/cache.h b/cache.h
index b48884225d..88c2fa8d95 100644
--- a/cache.h
+++ b/cache.h
@@ -65,8 +65,14 @@ struct cache_entry {
#define CE_NAMEMASK (0x0fff)
#define CE_STAGEMASK (0x3000)
+#define CE_STAGESHIFT 12
-#define create_ce_flags(len, stage) htons((len) | ((stage) << 12))
+#define create_ce_flags(len, stage) htons((len) | ((stage) << CE_STAGESHIFT))
+#define ce_namelen(ce) (CE_NAMEMASK & ntohs((ce)->ce_flags))
+#define ce_size(ce) cache_entry_size(ce_namelen(ce))
+#define ce_stage(ce) ((CE_STAGEMASK & ntohs((ce)->ce_flags)) >> CE_STAGESHIFT)
+
+#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
const char *sha1_file_directory;
struct cache_entry **active_cache;
@@ -75,10 +81,6 @@ unsigned int active_nr, active_alloc;
#define DB_ENVIRONMENT "SHA1_FILE_DIRECTORY"
#define DEFAULT_DB_ENVIRONMENT ".git/objects"
-#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
-#define ce_namelen(ce) (CE_NAMEMASK & ntohs((ce)->ce_flags))
-#define ce_size(ce) cache_entry_size(ce_namelen(ce))
-
#define alloc_nr(x) (((x)+16)*3/2)
/* Initialize and use the cache information */