summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r--include/git2/diff.h33
1 files changed, 14 insertions, 19 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index a0cfbc918..e5e641a2a 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -725,24 +725,17 @@ GIT_EXTERN(int) git_diff_index_to_workdir(
* The tree you provide will be used for the "old_file" side of the delta,
* and the working directory will be used for the "new_file" side.
*
- * Please note: this is *NOT* the same as `git diff <treeish>`. Running
- * `git diff HEAD` or the like actually uses information from the index,
- * along with the tree and working directory info.
- *
- * This function returns strictly the differences between the tree and the
- * files contained in the working directory, regardless of the state of
- * files in the index. It may come as a surprise, but there is no direct
- * equivalent in core git.
- *
- * To emulate `git diff <tree>`, use `git_diff_tree_to_workdir_with_index`
- * (or `git_diff_tree_to_index` and `git_diff_index_to_workdir`, then call
- * `git_diff_merge` on the results). That will yield a `git_diff` that
- * matches the git output.
- *
- * If this seems confusing, take the case of a file with a staged deletion
- * where the file has then been put back into the working dir and modified.
- * The tree-to-workdir diff for that file is 'modified', but core git would
- * show status 'deleted' since there is a pending deletion in the index.
+ * This is not the same as `git diff <treeish>` or `git diff-index
+ * <treeish>`. Those commands use information from the index, whereas this
+ * function strictly returns the differences between the tree and the files
+ * in the working directory, regardless of the state of the index. Use
+ * `git_diff_tree_to_workdir_with_index` to emulate those commands.
+ *
+ * To see difference between this and `git_diff_tree_to_workdir_with_index`,
+ * consider the example of a staged file deletion where the file has then
+ * been put back into the working dir and further modified. The
+ * tree-to-workdir diff for that file is 'modified', but `git diff` would
+ * show status 'deleted' since there is a staged delete.
*
* @param diff A pointer to a git_diff pointer that will be allocated.
* @param repo The repository containing the tree.
@@ -1143,12 +1136,14 @@ GIT_EXTERN(size_t) git_diff_stats_deletions(
* @param out buffer to store the formatted diff statistics in.
* @param stats A `git_diff_stats` generated by one of the above functions.
* @param format Formatting option.
+ * @param width Target width for output (only affects GIT_DIFF_STATS_FULL)
* @return 0 on success; non-zero on error
*/
GIT_EXTERN(int) git_diff_stats_to_buf(
git_buf *out,
const git_diff_stats *stats,
- git_diff_stats_format_t format);
+ git_diff_stats_format_t format,
+ size_t width);
/**
* Deallocate a `git_diff_stats`.