summaryrefslogtreecommitdiff
path: root/src/patch_parse.c
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 /src/patch_parse.c
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 'src/patch_parse.c')
-rw-r--r--src/patch_parse.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/patch_parse.c b/src/patch_parse.c
index 11e26936c..323f8dc95 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -197,15 +197,11 @@ static int parse_header_oid(
static int parse_header_git_index(
git_patch_parsed *patch, patch_parse_ctx *ctx)
{
- /*
- * TODO: we read the prefix provided in the diff into the delta's id
- * field, but do not mark is at an abbreviated id.
- */
- size_t oid_len, nid_len;
-
- if (parse_header_oid(&patch->base.delta->old_file.id, &oid_len, ctx) < 0 ||
+ if (parse_header_oid(&patch->base.delta->old_file.id,
+ &patch->base.delta->old_file.id_abbrev, ctx) < 0 ||
parse_advance_expected(ctx, "..", 2) < 0 ||
- parse_header_oid(&patch->base.delta->new_file.id, &nid_len, ctx) < 0)
+ parse_header_oid(&patch->base.delta->new_file.id,
+ &patch->base.delta->new_file.id_abbrev, ctx) < 0)
return -1;
if (ctx->line_len > 0 && ctx->line[0] == ' ') {