diff options
author | Pierre-Olivier Latour <pol@mac.com> | 2015-04-15 15:28:03 -0700 |
---|---|---|
committer | Pierre-Olivier Latour <pol@mac.com> | 2015-04-15 15:28:03 -0700 |
commit | db853748f6ed90766f5878afdb1473fa11d950e3 (patch) | |
tree | c65809024511be09977ccdfb20f68c35496e48d6 /src/diff.c | |
parent | cc93ad16502ea09b1923ca9eb1b291ced646cf38 (diff) | |
download | libgit2-db853748f6ed90766f5878afdb1473fa11d950e3.tar.gz |
Fixed GIT_DIFF_UPDATE_INDEX not being aware of executable bit changes
In the prior implementation, enabling GIT_DIFF_UPDATE_INDEX would overwrite
entries in the index with the ones generated from scanning the working if the
OID was the same.
Because this OID comparison ignores file modes, this means an file in the
workdir with only an exec bit difference with the one in the index would end
up being overwritten, resulting in the exec bit being loss. There might be
other related bugs but the fix of comparing OIDs and file modes should
address them all.
Diffstat (limited to 'src/diff.c')
-rw-r--r-- | src/diff.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c index ba8a1b884..08e218cce 100644 --- a/src/diff.c +++ b/src/diff.c @@ -807,7 +807,7 @@ static int maybe_modified( */ if (modified_uncertain && git_oid_iszero(&nitem->id)) { const git_oid *update_check = - DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) ? + 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) |