summaryrefslogtreecommitdiff
path: root/include/git2/diff.h
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-22 18:25:03 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:05 -0500
commitd68cb736776e0f2f9494b49e2da30a9c4b9fc2c7 (patch)
treed8b8b7bffac2560bae167cb02dd3da8131e40d1e /include/git2/diff.h
parente7ec327d4b94d8237f6238fb3d282bd3434b2b56 (diff)
downloadlibgit2-d68cb736776e0f2f9494b49e2da30a9c4b9fc2c7.tar.gz
diff: include oid length in deltas
Now that `git_diff_delta` data can be produced by reading patch file data, which may have an abbreviated oid, allow consumers to know that the id is abbreviated.
Diffstat (limited to 'include/git2/diff.h')
-rw-r--r--include/git2/diff.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/git2/diff.h b/include/git2/diff.h
index f3bb337b7..065a786e9 100644
--- a/include/git2/diff.h
+++ b/include/git2/diff.h
@@ -264,10 +264,15 @@ typedef enum {
* link, a submodule commit id, or even a tree (although that only if you
* are tracking type changes or ignored/untracked directories).
*
- * The `oid` is the `git_oid` of the item. If the entry represents an
+ * The `id` is the `git_oid` of the item. If the entry represents an
* absent side of a diff (e.g. the `old_file` of a `GIT_DELTA_ADDED` delta),
* then the oid will be zeroes.
*
+ * The `id_abbrev` represents the known length of the `id` field, when
+ * converted to a hex string. It is generally `GIT_OID_HEXSZ`, unless this
+ * delta was created from reading a patch file, in which case it may be
+ * abbreviated to something reasonable, like 7 characters.
+ *
* `path` is the NUL-terminated path to the entry relative to the working
* directory of the repository.
*
@@ -280,6 +285,7 @@ typedef enum {
*/
typedef struct {
git_oid id;
+ int id_abbrev;
const char *path;
git_off_t size;
uint32_t flags;