diff options
author | Ben Straub <bs@github.com> | 2013-08-08 08:53:37 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-08-08 08:53:37 -0700 |
commit | bf145a6a2f08add441f55387e5ae7daef58187ae (patch) | |
tree | b191401ba86062de136d435d92b40239faf5cb09 /src/diff_file.c | |
parent | 46c37911155a01db13185a70d34383b7d7133653 (diff) | |
parent | e8242022bc409b3cb7e234eabdd9bda05ae3a158 (diff) | |
download | libgit2-bf145a6a2f08add441f55387e5ae7daef58187ae.tar.gz |
Merge pull request #1746 from libgit2/rename-detection-performance
Rename detection slow
Diffstat (limited to 'src/diff_file.c')
-rw-r--r-- | src/diff_file.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/diff_file.c b/src/diff_file.c index 9d06daafa..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)) @@ -417,6 +407,9 @@ int git_diff_file_content__load(git_diff_file_content *fc) void git_diff_file_content__unload(git_diff_file_content *fc) { + if ((fc->flags & GIT_DIFF_FLAG__LOADED) == 0) + return; + if (fc->flags & GIT_DIFF_FLAG__FREE_DATA) { git__free(fc->map.data); fc->map.data = ""; |