diff options
Diffstat (limited to 'src/index.c')
| -rw-r--r-- | src/index.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/index.c b/src/index.c index 19de43d29..dbf1ab529 100644 --- a/src/index.c +++ b/src/index.c @@ -349,7 +349,7 @@ int git_index_open(git_index **index_out, const char *index_path) *index_out = index; GIT_REFCOUNT_INC(index); - return (index_path != NULL) ? git_index_read(index, false) : 0; + return (index_path != NULL) ? git_index_read(index, true) : 0; } int git_index_new(git_index **out) @@ -451,7 +451,7 @@ unsigned int git_index_caps(const git_index *index) (index->no_symlinks ? GIT_INDEXCAP_NO_SYMLINKS : 0)); } -int git_index_read(git_index *index, int only_if_changed) +int git_index_read(git_index *index, int force) { int error = 0, updated; git_buf buffer = GIT_BUF_INIT; @@ -464,13 +464,13 @@ int git_index_read(git_index *index, int only_if_changed) index->on_disk = git_path_exists(index->index_file_path); if (!index->on_disk) { - if (!only_if_changed) + if (force) git_index_clear(index); return 0; } updated = git_futils_filestamp_check(&stamp, index->index_file_path); - if (updated < 0 || (only_if_changed && !updated)) + if (updated < 0 || (!updated && !force)) return updated; error = git_futils_readbuffer(&buffer, index->index_file_path); |
