diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-09-22 18:25:03 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-05-26 13:01:05 -0500 |
commit | d68cb736776e0f2f9494b49e2da30a9c4b9fc2c7 (patch) | |
tree | d8b8b7bffac2560bae167cb02dd3da8131e40d1e /src/diff.c | |
parent | e7ec327d4b94d8237f6238fb3d282bd3434b2b56 (diff) | |
download | libgit2-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/diff.c')
-rw-r--r-- | src/diff.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/diff.c b/src/diff.c index 26c0b895b..9c27511f6 100644 --- a/src/diff.c +++ b/src/diff.c @@ -151,11 +151,13 @@ static int diff_delta__from_one( delta->old_file.size = entry->file_size; delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS; git_oid_cpy(&delta->old_file.id, &entry->id); + delta->old_file.id_abbrev = GIT_OID_HEXSZ; } else /* ADDED, IGNORED, UNTRACKED */ { delta->new_file.mode = entry->mode; delta->new_file.size = entry->file_size; delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS; git_oid_cpy(&delta->new_file.id, &entry->id); + delta->new_file.id_abbrev = GIT_OID_HEXSZ; } delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID; @@ -208,12 +210,14 @@ static int diff_delta__from_two( delta->old_file.size = old_entry->file_size; delta->old_file.mode = old_mode; git_oid_cpy(&delta->old_file.id, old_id); + delta->old_file.id_abbrev = GIT_OID_HEXSZ; delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID | GIT_DIFF_FLAG_EXISTS; } if (!git_index_entry_is_conflict(new_entry)) { git_oid_cpy(&delta->new_file.id, new_id); + delta->new_file.id_abbrev = GIT_OID_HEXSZ; delta->new_file.size = new_entry->file_size; delta->new_file.mode = new_mode; delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS; |