diff: convert diff_flush_patch_id to struct object_id
Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
May 30, 2017 at 10:30 UTC
bd25f288767aa26f42ac02d2d36695c8df9134dd
3 files changed
+8
-8
diff.c
+6
-6
@@ -4584,7 +4584,7 @@ static void patch_id_add_mode(git_SHA_CTX *ctx, unsigned mode)
4584
}
4585
4586
/* returns 0 upon success, and writes result into sha1 */
4587
-static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1, int diff_header_only)
4587
+static int diff_get_patch_id(struct diff_options *options, struct object_id *oid, int diff_header_only)
4588
{
4589
struct diff_queue_struct *q = &diff_queued_diff;
4590
int i;
@@ -4656,9 +4656,9 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1,
4656
if (diff_filespec_is_binary(p->one) ||
4657
diff_filespec_is_binary(p->two)) {
4658
git_SHA1_Update(&ctx, oid_to_hex(&p->one->oid),
4659
- 40);
4659
+ GIT_SHA1_HEXSZ);
4660
git_SHA1_Update(&ctx, oid_to_hex(&p->two->oid),
4661
- 40);
4661
+ GIT_SHA1_HEXSZ);
4662
continue;
4663
}
4664
@@ -4671,15 +4671,15 @@ static int diff_get_patch_id(struct diff_options *options, unsigned char *sha1,
4671
p->one->path);
4672
}
4673
4674
- git_SHA1_Final(sha1, &ctx);
4674
+ git_SHA1_Final(oid->hash, &ctx);
4675
return 0;
4676
}
4677
4678
-int diff_flush_patch_id(struct diff_options *options, unsigned char *sha1, int diff_header_only)
4678
+int diff_flush_patch_id(struct diff_options *options, struct object_id *oid, int diff_header_only)
4679
{
4680
struct diff_queue_struct *q = &diff_queued_diff;
4681
int i;
4682
- int result = diff_get_patch_id(options, sha1, diff_header_only);
4682
+ int result = diff_get_patch_id(options, oid, diff_header_only);
4683
4684
for (i = 0; i < q->nr; i++)
4685
diff_free_filepair(q->queue[i]);
diff.h
+1
-1
@@ -354,7 +354,7 @@ extern int run_diff_files(struct rev_info *revs, unsigned int option);
354
extern int run_diff_index(struct rev_info *revs, int cached);
355
356
extern int do_diff_cache(const struct object_id *, struct diff_options *);
357
-extern int diff_flush_patch_id(struct diff_options *, unsigned char *, int);
357
+extern int diff_flush_patch_id(struct diff_options *, struct object_id *, int);
358
359
extern int diff_result_code(struct diff_options *, int);
360
patch-ids.c
+1
-1
@@ -22,7 +22,7 @@ int commit_patch_id(struct commit *commit, struct diff_options *options,
22
else
23
diff_root_tree_sha1(commit->object.oid.hash, "", options);
24
diffcore_std(options);
25
- return diff_flush_patch_id(options, oid->hash, diff_header_only);
25
+ return diff_flush_patch_id(options, oid, diff_header_only);
26
}
27
28
/*