summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-09-25 10:48:50 -0700
committerRussell Belfer <rb@github.com>2012-09-25 16:35:05 -0700
commit642863086575a61b3ed0bbbe909f4f07d87ff9db (patch)
tree22cb6c0d2355e4a15edd645104b39fe2c33c97ac /include/git2/diff.h
parent5f69a31f7d706aa5788ad9937391577a66e3c77d (diff)
downloadlibgit2-642863086575a61b3ed0bbbe909f4f07d87ff9db.tar.gz
Fix bugs in new diff patch code
This fixes all the bugs in the new diff patch code. The only really interesting one is that when we merge two diffs, we now have to actually exclude diff delta records that are not supposed to be tracked, as opposed to before where they could be included because they would be skipped silently by `git_diff_foreach()`. Other than that, there are just minor errors.
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r--include/git2/diff.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index d216c1303..154264546 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -401,6 +401,20 @@ GIT_EXTERN(int) git_diff_print_compact(
git_diff_data_fn print_cb);
/**
+ * Look up the single character abbreviation for a delta status code.
+ *
+ * When you call `git_diff_print_compact` it prints single letter codes into
+ * the output such as 'A' for added, 'D' for deleted, 'M' for modified, etc.
+ * It is sometimes convenient to convert a git_delta_t value into these
+ * letters for your own purposes. This function does just that. By the
+ * way, unmodified will return a space (i.e. ' ').
+ *
+ * @param delta_t The git_delta_t value to look up
+ * @return The single character label for that code
+ */
+GIT_EXTERN(char) git_diff_status_char(git_delta_t status);
+
+/**
* Iterate over a diff generating text output like "git diff".
*
* This is a super easy way to generate a patch from a diff.
@@ -453,9 +467,9 @@ GIT_EXTERN(size_t) git_diff_num_deltas_of_type(
* done with it. You can use the patch object to loop over all the hunks
* and lines in the diff of the one delta.
*
- * For a binary file, no `git_diff_patch` will be created, the output will
- * be set to NULL, and the `binary` flag will be set true in the
- * `git_diff_delta` structure.
+ * For an unchanged file or a binary file, no `git_diff_patch` will be
+ * created, the output will be set to NULL, and the `binary` flag will be
+ * set true in the `git_diff_delta` structure.
*
* The `git_diff_delta` pointer points to internal data and you do not have
* to release it when you are done with it. It will go away when the