diff options
| author | Russell Belfer <rb@github.com> | 2014-04-10 22:31:01 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2014-04-17 14:56:41 -0700 |
| commit | 7d4908724fd7d4d8e096b4faf2c652ba5b77644e (patch) | |
| tree | 2fcd09e7e040607c124f6e658c31f33e1aa1868a /src/index.c | |
| parent | 1fa17b5c92cb92a2785fba403b87525169b205c0 (diff) | |
| download | libgit2-7d4908724fd7d4d8e096b4faf2c652ba5b77644e.tar.gz | |
Attribute file cache refactor
This is a big refactoring of the attribute file cache to be a bit
simpler which in turn makes it easier to enforce a lock around any
updates to the cache so that it can be used in a threaded env.
Tons of changes to the attributes and ignores code.
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/index.c b/src/index.c index 27a557cfb..d7d937f63 100644 --- a/src/index.c +++ b/src/index.c @@ -607,8 +607,15 @@ int git_index_read(git_index *index, int force) } updated = git_futils_filestamp_check(&stamp, index->index_file_path); - if (updated < 0 || (!updated && !force)) + if (updated < 0) { + giterr_set( + GITERR_INDEX, + "Failed to read index: '%s' no longer exists", + index->index_file_path); return updated; + } + if (!updated && !force) + return 0; error = git_futils_readbuffer(&buffer, index->index_file_path); if (error < 0) @@ -667,11 +674,11 @@ int git_index_write(git_index *index) if ((error = git_filebuf_commit(&file)) < 0) return error; - error = git_futils_filestamp_check(&index->stamp, index->index_file_path); - if (error < 0) - return error; + if (git_futils_filestamp_check(&index->stamp, index->index_file_path) < 0) + /* index could not be read from disk! */; + else + index->on_disk = 1; - index->on_disk = 1; return 0; } |
