summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-11-08 21:58:24 -0800
committerRussell Belfer <rb@github.com>2012-11-09 13:52:07 -0800
commita1bf70e4c94cea054fe5812344e6e70f13402be6 (patch)
tree58ce26f8392a7d0e2fe39b061ce5c4395fd2aec2 /src/diff.c
parentad9a921b92a964a0f28a5f0d59079cde5a0ada1e (diff)
downloadlibgit2-a1bf70e4c94cea054fe5812344e6e70f13402be6.tar.gz
fix regression in diff with submodule oid
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/diff.c b/src/diff.c
index 015c77edd..ea19d4799 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -506,16 +506,15 @@ static int maybe_modified(
/* if we got here and decided that the files are modified, but we
* haven't calculated the OID of the new item, then calculate it now
*/
- if (status != GIT_DELTA_UNMODIFIED &&
- git_oid_iszero(&nitem->oid) && !use_noid)
- {
- if (git_diff__oid_for_file(diff->repo,
- nitem->path, nitem->mode, nitem->file_size, &noid) < 0)
- return -1;
- if (omode == nmode && git_oid_equal(&oitem->oid, &noid))
+ if (status != GIT_DELTA_UNMODIFIED && git_oid_iszero(&nitem->oid)) {
+ if (!use_noid) {
+ if (git_diff__oid_for_file(diff->repo,
+ nitem->path, nitem->mode, nitem->file_size, &noid) < 0)
+ return -1;
+ use_noid = &noid;
+ }
+ if (omode == nmode && git_oid_equal(&oitem->oid, use_noid))
status = GIT_DELTA_UNMODIFIED;
- /* store calculated oid so we don't have to recalc later */
- use_noid = &noid;
}
return diff_delta__from_two(