summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2005-05-05 14:38:25 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-05 08:23:01 -0700
commit8ae0a8c514dc492de8aadf3ca6bb4ad55e33960e (patch)
tree13ef1d82cc91ccc9a4a7534aa8a3cf9cd85b0b59 /read-cache.c
parent5210372fe4a2e2ec73291434e86c07345524a276 (diff)
downloadgit-8ae0a8c514dc492de8aadf3ca6bb4ad55e33960e.tar.gz
[PATCH] git and symlinks as tracked content
Allow to store and track symlink in the repository. A symlink is stored the same way as a regular file, only with the appropriate mode bits set. The symlink target is therefore stored in a blob object. This will hopefully make our udev repository fully functional. :) Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index 53f1da815b..5703f30b6a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -13,6 +13,16 @@ int cache_match_stat(struct cache_entry *ce, struct stat *st)
{
unsigned int changed = 0;
+ switch (ntohl(ce->ce_mode) & S_IFMT) {
+ case S_IFREG:
+ changed |= !S_ISREG(st->st_mode) ? TYPE_CHANGED : 0;
+ break;
+ case S_IFLNK:
+ changed |= !S_ISLNK(st->st_mode) ? TYPE_CHANGED : 0;
+ break;
+ default:
+ die("internal error: ce_mode is %o", ntohl(ce->ce_mode));
+ }
if (ce->ce_mtime.sec != htonl(st->st_mtime))
changed |= MTIME_CHANGED;
if (ce->ce_ctime.sec != htonl(st->st_ctime))