aboutsummaryrefslogtreecommitdiff
path: root/cache.h
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 /cache.h
parent5210372fe4a2e2ec73291434e86c07345524a276 (diff)
downloadgit-8ae0a8c514dc492de8aadf3ca6bb4ad55e33960e.tar.gz
git-8ae0a8c514dc492de8aadf3ca6bb4ad55e33960e.tar.xz
[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 'cache.h')
-rw-r--r--cache.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/cache.h b/cache.h
index 8dd812827..e6ce7312c 100644
--- a/cache.h
+++ b/cache.h
@@ -87,7 +87,14 @@ struct cache_entry {
#define ce_stage(ce) ((CE_STAGEMASK & ntohs((ce)->ce_flags)) >> CE_STAGESHIFT)
#define ce_permissions(mode) (((mode) & 0100) ? 0755 : 0644)
-#define create_ce_mode(mode) htonl(S_IFREG | ce_permissions(mode))
+static inline unsigned int create_ce_mode(unsigned int mode)
+{
+ if (S_ISREG(mode))
+ return htonl(S_IFREG | ce_permissions(mode));
+ if (S_ISLNK(mode))
+ return htonl(S_IFLNK);
+ return htonl(mode);
+}
#define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
@@ -124,6 +131,7 @@ extern int index_fd(unsigned char *sha1, int fd, struct stat *st);
#define MODE_CHANGED 0x0008
#define INODE_CHANGED 0x0010
#define DATA_CHANGED 0x0020
+#define TYPE_CHANGED 0x0040
/* Return a statically allocated filename matching the sha1 signature */
extern char *sha1_file_name(const unsigned char *sha1);