summaryrefslogtreecommitdiff
path: root/src/diff.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-06-19 15:27:25 -0700
committerRussell Belfer <rb@github.com>2013-06-19 15:27:25 -0700
commitf30fff45a752cb0781067ad48c283e49345a5813 (patch)
tree3acc669674a087139db8ead4ce5425cc9bd1ed7e /src/diff.c
parent85b8b18b6a07b74dd2631c3a647ca758660bf298 (diff)
downloadlibgit2-f30fff45a752cb0781067ad48c283e49345a5813.tar.gz
Add index pathspec-based operations
This adds three new public APIs for manipulating the index: 1. `git_index_add_all` is similar to `git add -A` and will add files in the working directory that match a pathspec to the index while honoring ignores, etc. 2. `git_index_remove_all` removes files from the index that match a pathspec. 3. `git_index_update_all` updates entries in the index based on the current contents of the working directory, either added the new information or removing the entry from the index.
Diffstat (limited to 'src/diff.c')
-rw-r--r--src/diff.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/diff.c b/src/diff.c
index fa2c5c71d..633601699 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -675,8 +675,10 @@ static int maybe_modified(
}
}
- /* if oids and modes match, then file is unmodified */
- else if (git_oid_equal(&oitem->oid, &nitem->oid) && omode == nmode)
+ /* if oids and modes match (and are valid), then file is unmodified */
+ else if (git_oid_equal(&oitem->oid, &nitem->oid) &&
+ omode == nmode &&
+ !git_oid_iszero(&oitem->oid))
status = GIT_DELTA_UNMODIFIED;
/* if we have an unknown OID and a workdir iterator, then check some