]> git.ipfire.org Git - thirdparty/git.git/commitdiff
notes: convert format_display_notes to struct object_id
authorbrian m. carlson <sandals@crustytoothpaste.net>
Tue, 30 May 2017 17:30:41 +0000 (10:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Jun 2017 00:36:06 +0000 (09:36 +0900)
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>
log-tree.c
notes.c
notes.h
revision.c

index a4ec11c2bf62bbda4304d19913f25965247d4027..9c0c64a2d857a07f9fb5abfc5d9833d48b6d7d43 100644 (file)
@@ -655,7 +655,7 @@ void show_log(struct rev_info *opt)
                struct strbuf notebuf = STRBUF_INIT;
 
                raw = (opt->commit_format == CMIT_FMT_USERFORMAT);
-               format_display_notes(commit->object.oid.hash, &notebuf,
+               format_display_notes(&commit->object.oid, &notebuf,
                                     get_log_output_encoding(), raw);
                ctx.notes_message = notebuf.len
                        ? strbuf_detach(&notebuf, NULL)
diff --git a/notes.c b/notes.c
index fe4db2c1ecd9a8f9afa530e9d67a1e663da54802..b5cabafde61f127280e2183dd65280fe06f725f5 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -1215,7 +1215,7 @@ void free_notes(struct notes_tree *t)
  * (raw != 0) gives the %N userformat; otherwise, the note message is given
  * for human consumption.
  */
-static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
+static void format_note(struct notes_tree *t, const struct object_id *object_oid,
                        struct strbuf *sb, const char *output_encoding, int raw)
 {
        static const char utf8[] = "utf-8";
@@ -1229,7 +1229,7 @@ static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
        if (!t->initialized)
                init_notes(t, NULL, NULL, 0);
 
-       oid = get_note(t, object_sha1);
+       oid = get_note(t, object_oid->hash);
        if (!oid)
                return;
 
@@ -1277,13 +1277,13 @@ static void format_note(struct notes_tree *t, const unsigned char *object_sha1,
        free(msg);
 }
 
-void format_display_notes(const unsigned char *object_sha1,
+void format_display_notes(const struct object_id *object_oid,
                          struct strbuf *sb, const char *output_encoding, int raw)
 {
        int i;
        assert(display_notes_trees);
        for (i = 0; display_notes_trees[i]; i++)
-               format_note(display_notes_trees[i], object_sha1, sb,
+               format_note(display_notes_trees[i], object_oid, sb,
                            output_encoding, raw);
 }
 
diff --git a/notes.h b/notes.h
index c72bb971060bc27965e0dd4ad859e7c768d6222e..a66532103c4ff2224a1f6ab3bf26bf6c365197d0 100644 (file)
--- a/notes.h
+++ b/notes.h
@@ -277,7 +277,7 @@ void init_display_notes(struct display_notes_opt *opt);
  *
  * You *must* call init_display_notes() before using this function.
  */
-void format_display_notes(const unsigned char *object_sha1,
+void format_display_notes(const struct object_id *object_oid,
                          struct strbuf *sb, const char *output_encoding, int raw);
 
 /*
index b02394530926ebe24233de5e6653e7127755675a..475d5b2dc111d18315e089798cbf85078dac96d6 100644 (file)
@@ -2908,7 +2908,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
        if (opt->show_notes) {
                if (!buf.len)
                        strbuf_addstr(&buf, message);
-               format_display_notes(commit->object.oid.hash, &buf, encoding, 1);
+               format_display_notes(&commit->object.oid, &buf, encoding, 1);
        }
 
        /*