summaryrefslogtreecommitdiff
path: root/src/diff_output.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-08-09 19:43:25 -0700
committerRussell Belfer <rb@github.com>2012-08-24 11:00:27 -0700
commit5f4a61aea834fe25ce1596bc9c0e0b5e563aa98b (patch)
treeda0237ee649e009b5f914dfdace54d26e819aaaf /src/diff_output.c
parent0c8858de8c82bae3fd88513724689a07d231da7e (diff)
downloadlibgit2-5f4a61aea834fe25ce1596bc9c0e0b5e563aa98b.tar.gz
Working implementation of git_submodule_status
This is a big redesign of the git_submodule_status API and the implementation of the redesigned API. It also fixes a number of bugs that I found in other parts of the submodule API while writing the tests for the status part. This also fixes a couple of bugs in the iterators that had not been noticed before - one with iterating when there is a gitlink (i.e. separate-work-dir) and one where I was treating anything even vaguely submodule-like as a submodule, more aggressively than core git does.
Diffstat (limited to 'src/diff_output.c')
-rw-r--r--src/diff_output.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/diff_output.c b/src/diff_output.c
index d269a4cee..2bf939f33 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -718,6 +718,25 @@ int git_diff_print_patch(
return error;
}
+int git_diff_entrycount(git_diff_list *diff, int delta_t)
+{
+ int count = 0;
+ unsigned int i;
+ git_diff_delta *delta;
+
+ assert(diff);
+
+ if (delta_t < 0)
+ return diff->deltas.length;
+
+ git_vector_foreach(&diff->deltas, i, delta) {
+ if (delta->status == (git_delta_t)delta_t)
+ count++;
+ }
+
+ return count;
+}
+
int git_diff_blobs(
git_blob *old_blob,
git_blob *new_blob,