aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-06-25 11:49:48 -0700
committerJunio C Hamano <gitster@pobox.com>2014-06-25 11:49:48 -0700
commit1881d2b88c4b889dcb95782ad4bc5395808438e9 (patch)
treecab7b82ccfc98e89b355c3dc209b7ec6656e1b93 /cache.h
parent85785df6d6db50ff37d0ff1878c16ad69a063f6a (diff)
parent426ddeead6112955dfb50ccf9bb4af05d1ca9082 (diff)
downloadgit-1881d2b88c4b889dcb95782ad4bc5395808438e9.tar.gz
git-1881d2b88c4b889dcb95782ad4bc5395808438e9.tar.xz
Merge branch 'ym/fix-opportunistic-index-update-race' into maint
"git status", even though it is a read-only operation, tries to update the index with refreshed lstat(2) info to optimize future accesses to the working tree opportunistically, but this could race with a "read-write" operation that modify the index while it is running. Detect such a race and avoid overwriting the index. * ym/fix-opportunistic-index-update-race: read-cache.c: verify index file before we opportunistically update it wrapper.c: add xpread() similar to xread()
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 107ac61b6..cc46be4e0 100644
--- a/cache.h
+++ b/cache.h
@@ -279,6 +279,7 @@ struct index_state {
initialized : 1;
struct hashmap name_hash;
struct hashmap dir_hash;
+ unsigned char sha1[20];
};
extern struct index_state the_index;
@@ -1322,6 +1323,8 @@ extern void fsync_or_die(int fd, const char *);
extern ssize_t read_in_full(int fd, void *buf, size_t count);
extern ssize_t write_in_full(int fd, const void *buf, size_t count);
+extern ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset);
+
static inline ssize_t write_str_in_full(int fd, const char *str)
{
return write_in_full(fd, str, strlen(str));