summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-22 13:57:57 -0700
committerRussell Belfer <rb@github.com>2012-08-22 13:57:57 -0700
commit5fdc41e76591aebdbae3b49440bc2c8b2430718c (patch)
treea879ae6630a4cde62aa3b06dea4d74c673a16a2c /src/diff.c
parentcfda29e38260f19e77f1746c4f6f1c2cab453934 (diff)
downloadlibgit2-5fdc41e76591aebdbae3b49440bc2c8b2430718c.tar.gz
Minor bug fixes in diff code
In looking at PR #878, I found a few small bugs in the diff code, mostly related to work that can be avoided when processing tree- to-tree diffs that was always being carried out. This commit has some small fixes in it.
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index a5bf07a65..9abf8b9f5 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -470,7 +470,8 @@ static int maybe_modified(
/* on platforms with no symlinks, preserve mode of existing symlinks */
if (S_ISLNK(omode) && S_ISREG(nmode) &&
- !(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS))
+ !(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS) &&
+ new_iter->type == GIT_ITERATOR_WORKDIR)
nmode = omode;
/* on platforms with no execmode, just preserve old mode */