summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-05-15 14:23:12 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-19 09:50:57 -0700
commit415e96c8b7e7d47f98a45ae1b6d524418245a3b4 (patch)
tree08f5f8433a6d56642b64fe9ab941647da6c8aef5 /read-cache.c
parent875d0f8ddb1d420f6465498842740c4f5ab03e6f (diff)
downloadgit-415e96c8b7e7d47f98a45ae1b6d524418245a3b4.tar.gz
[PATCH] Implement git-checkout-cache -u to update stat information in the cache.
With -u flag, git-checkout-cache picks up the stat information from newly created file and updates the cache. This removes the need to run git-update-cache --refresh immediately after running git-checkout-cache. Signed-off-by: Junio C Hamano <junkio@cox.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 14ed4fdf65..732f483cda 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -9,6 +9,26 @@
struct cache_entry **active_cache = NULL;
unsigned int active_nr = 0, active_alloc = 0, active_cache_changed = 0;
+/*
+ * This only updates the "non-critical" parts of the directory
+ * cache, ie the parts that aren't tracked by GIT, and only used
+ * to validate the cache.
+ */
+void fill_stat_cache_info(struct cache_entry *ce, struct stat *st)
+{
+ ce->ce_ctime.sec = htonl(st->st_ctime);
+ ce->ce_mtime.sec = htonl(st->st_mtime);
+#ifdef NSEC
+ ce->ce_ctime.nsec = htonl(st->st_ctim.tv_nsec);
+ ce->ce_mtime.nsec = htonl(st->st_mtim.tv_nsec);
+#endif
+ ce->ce_dev = htonl(st->st_dev);
+ ce->ce_ino = htonl(st->st_ino);
+ ce->ce_uid = htonl(st->st_uid);
+ ce->ce_gid = htonl(st->st_gid);
+ ce->ce_size = htonl(st->st_size);
+}
+
int ce_match_stat(struct cache_entry *ce, struct stat *st)
{
unsigned int changed = 0;