Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-11-01 20:51:01 +0400
committerRussell Belfer <rb@github.com>2013-11-01 21:20:51 +0400
commit8e5a8ef86f1d528472884f737612083abda86e17 (patch)
tree71b090fb4b7c91b8aa54b31fd458e768fec86625 /src/index.c
parent4bf630b6baf342fa929a8f7e4e6643197b74216f (diff)
Convert git_index_read to have a "force" flag
This is a little more intuitive than the turned-around option that I originally wrote.
Diffstat (limited to 'src/index.c')
-rw-r--r--src/index.c8
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);