summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-04-17 12:32:39 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2015-04-17 12:32:39 -0500
commita5bf599c9d2bd934823fbd99e73d6378289e5dfb (patch)
treee1146b058db5c0637296528f416ebc54103fd0c1
parentc694f9fae8bbbcde90f4b446b2a56ede4ea1fa68 (diff)
parentdb853748f6ed90766f5878afdb1473fa11d950e3 (diff)
downloadlibgit2-a5bf599c9d2bd934823fbd99e73d6378289e5dfb.tar.gz
Merge pull request #3047 from git-up/diff_fixes
Diff fixes
-rw-r--r--src/diff.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/diff.c b/src/diff.c
index f1bc28fd9..08e218cce 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -621,7 +621,7 @@ int git_diff__oid_for_entry(
git_index *idx;
if (!(error = git_repository_index__weakptr(&idx, diff->repo))) {
- memcpy(&entry.id, out, sizeof(entry.id));
+ git_oid_cpy(&entry.id, out);
error = git_index_add(idx, &entry);
}
}
@@ -806,15 +806,12 @@ static int maybe_modified(
* haven't calculated the OID of the new item, then calculate it now
*/
if (modified_uncertain && git_oid_iszero(&nitem->id)) {
- if (git_oid_iszero(&noid)) {
- const git_oid *update_check =
- DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) ?
- &oitem->id : NULL;
-
- if ((error = git_diff__oid_for_entry(
- &noid, diff, nitem, update_check)) < 0)
- return error;
- }
+ const git_oid *update_check =
+ DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) && omode == nmode ?
+ &oitem->id : NULL;
+ if ((error = git_diff__oid_for_entry(
+ &noid, diff, nitem, update_check)) < 0)
+ return error;
/* if oid matches, then mark unmodified (except submodules, where
* the filesystem content may be modified even if the oid still