notes: convert format_display_notes to struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

brian m. carlson committed May 30, 2017 at 10:30 UTC fb61e4d3abe2349eb0fabe0be8981626b4074fa7
4 files changed +7 -7
log-tree.c
+1 -1
@@ -655,7 +655,7 @@ void show_log(struct rev_info *opt)
655 struct strbuf notebuf = STRBUF_INIT;
656
657 raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
658 - format_display_notes(commit->object.oid.hash, &notebuf,
658 + format_display_notes(&commit->object.oid, &notebuf,
659 get_log_output_encoding(), raw);
660 ctx.notes_message = notebuf.len
661 ? strbuf_detach(&notebuf, NULL)
notes.c
+4 -4
@@ -1215,7 +1215,7 @@ void free_notes(struct notes_tree *t)
1215 * (raw != 0) gives the %N userformat; otherwise, the note message is given
1216 * for human consumption.
1217 */
1218 -static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
1218 +static void format_note(struct notes_tree *t, const struct object_id *object_oid,
1219 struct strbuf *sb, const char *output_encoding, int raw)
1220 {
1221 static const char utf8[] = "utf-8";
@@ -1229,7 +1229,7 @@ static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
1229 if (!t->initialized)
1230 init_notes(t, NULL, NULL, 0);
1231
1232 - oid = get_note(t, object_sha1);
1232 + oid = get_note(t, object_oid->hash);
1233 if (!oid)
1234 return;
1235
@@ -1277,13 +1277,13 @@ static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
1277 free(msg);
1278 }
1279
1280 -void format_display_notes(const unsigned char *object_sha1,
1280 +void format_display_notes(const struct object_id *object_oid,
1281 struct strbuf *sb, const char *output_encoding, int raw)
1282 {
1283 int i;
1284 assert(display_notes_trees);
1285 for (i = 0; display_notes_trees[i]; i++)
1286 - format_note(display_notes_trees[i], object_sha1, sb,
1286 + format_note(display_notes_trees[i], object_oid, sb,
1287 output_encoding, raw);
1288 }
1289
notes.h
+1 -1
@@ -277,7 +277,7 @@ void init_display_notes(struct display_notes_opt *opt);
277 *
278 * You *must* call init_display_notes() before using this function.
279 */
280 -void format_display_notes(const unsigned char *object_sha1,
280 +void format_display_notes(const struct object_id *object_oid,
281 struct strbuf *sb, const char *output_encoding, int raw);
282
283 /*
revision.c
+1 -1
@@ -2908,7 +2908,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
2908 if (opt->show_notes) {
2909 if (!buf.len)
2910 strbuf_addstr(&buf, message);
2911 - format_display_notes(commit->object.oid.hash, &buf, encoding, 1);
2911 + format_display_notes(&commit->object.oid, &buf, encoding, 1);
2912 }
2913
2914 /*