From ffbe1addd5a5b7b7c2f987625a5aa6c1d22e3705 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 6 May 2005 15:45:01 +0200 Subject: [PATCH] fix compare symlink against readlink not data Fix update-cache to compare the blob of a symlink against the link-target and not the file it points to. Also ignore all permissions applied to links. Thanks to Greg for recognizing this while he added our list of symlinks back to the udev repository. Signed-off-by: Kay Sievers Signed-off-by: Linus Torvalds --- read-cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'read-cache.c') diff --git a/read-cache.c b/read-cache.c index 5703f30b6a..2a88d18b16 100644 --- a/read-cache.c +++ b/read-cache.c @@ -16,6 +16,9 @@ int cache_match_stat(struct cache_entry *ce, struct stat *st) switch (ntohl(ce->ce_mode) & S_IFMT) { case S_IFREG: changed |= !S_ISREG(st->st_mode) ? TYPE_CHANGED : 0; + /* We consider only the owner x bit to be relevant for "mode changes" */ + if (0100 & (ntohl(ce->ce_mode) ^ st->st_mode)) + changed |= MODE_CHANGED; break; case S_IFLNK: changed |= !S_ISLNK(st->st_mode) ? TYPE_CHANGED : 0; @@ -43,9 +46,6 @@ int cache_match_stat(struct cache_entry *ce, struct stat *st) if (ce->ce_uid != htonl(st->st_uid) || ce->ce_gid != htonl(st->st_gid)) changed |= OWNER_CHANGED; - /* We consider only the owner x bit to be relevant for "mode changes" */ - if (0100 & (ntohl(ce->ce_mode) ^ st->st_mode)) - changed |= MODE_CHANGED; if (ce->ce_dev != htonl(st->st_dev) || ce->ce_ino != htonl(st->st_ino)) changed |= INODE_CHANGED; -- cgit v1.2.3