summaryrefslogtreecommitdiff
path: root/src/diff_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/diff_file.c')
-rw-r--r--src/diff_file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/diff_file.c b/src/diff_file.c
index 9804a943c..c7e9fbeee 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -338,15 +338,15 @@ static int diff_file_content_load_workdir_file(
if (error < 0)
goto cleanup;
- /* if file size doesn't match cached value, abort */
- if (fc->file->size && fc->file->size != new_file_size) {
+ if (!(fc->file->flags & GIT_DIFF_FLAG_VALID_SIZE)) {
+ fc->file->size = new_file_size;
+ fc->file->flags |= GIT_DIFF_FLAG_VALID_SIZE;
+ } else if (fc->file->size != new_file_size) {
git_error_set(GIT_ERROR_FILESYSTEM, "file changed before we could read it");
error = -1;
goto cleanup;
}
- fc->file->size = new_file_size;
-
if ((diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 0 &&
diff_file_content_binary_by_size(fc))
goto cleanup;