summaryrefslogtreecommitdiff
path: root/src/diff_file.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-07-24 17:48:37 -0700
committerRussell Belfer <rb@github.com>2013-07-24 17:48:37 -0700
commiteffdbeb3239b777e2b19fc4944643fc7f2a768c3 (patch)
tree997fc8b3a975010d7a9df07226bda8d5c0e92dea /src/diff_file.c
parenta5140f4dda66263a34080b11cfc34a49c9743100 (diff)
downloadlibgit2-effdbeb3239b777e2b19fc4944643fc7f2a768c3.tar.gz
Make rename detection file size fix better
The previous fix for checking file sizes with rename detection always loads the blob. In this version, if the odb backend can get the object header without loading the whole thing into memory, then we'll just use that, so that we can eliminate possible rename sources & targets without loading them.
Diffstat (limited to 'src/diff_file.c')
-rw-r--r--src/diff_file.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/diff_file.c b/src/diff_file.c
index 19bcf2d45..bcfef13cd 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -241,19 +241,9 @@ static int diff_file_content_load_blob(git_diff_file_content *fc)
/* if we don't know size, try to peek at object header first */
if (!fc->file->size) {
- git_odb *odb;
- size_t len;
- git_otype type;
-
- if (!(error = git_repository_odb__weakptr(&odb, fc->repo))) {
- error = git_odb__read_header_or_object(
- &odb_obj, &len, &type, odb, &fc->file->oid);
- git_odb_free(odb);
- }
- if (error)
+ if ((error = git_diff_file__resolve_zero_size(
+ fc->file, &odb_obj, fc->repo)) < 0)
return error;
-
- fc->file->size = len;
}
if (diff_file_content_binary_by_size(fc))