Notes API: get_commit_notes() -> format_note() + remove the commit restriction
There is really no reason why only commit objects can be annotated. By changing the struct commit parameter to get_commit_notes() into a sha1 we gain the ability to annotate any object type. To reflect this in the function naming as well, we rename get_commit_notes() to format_note(). This patch also fixes comments and variable names throughout notes.c as a consequence of the removal of the unnecessary 'commit' restriction. Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0ab1faae39
commit
a7e7eff662
8
pretty.c
8
pretty.c
@ -775,8 +775,8 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,
|
||||
}
|
||||
return 0; /* unknown %g placeholder */
|
||||
case 'N':
|
||||
get_commit_notes(commit, sb, git_log_output_encoding ?
|
||||
git_log_output_encoding : git_commit_encoding, 0);
|
||||
format_note(commit->object.sha1, sb, git_log_output_encoding ?
|
||||
git_log_output_encoding : git_commit_encoding, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -1095,8 +1095,8 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,
|
||||
strbuf_addch(sb, '\n');
|
||||
|
||||
if (context->show_notes)
|
||||
get_commit_notes(commit, sb, encoding,
|
||||
NOTES_SHOW_HEADER | NOTES_INDENT);
|
||||
format_note(commit->object.sha1, sb, encoding,
|
||||
NOTES_SHOW_HEADER | NOTES_INDENT);
|
||||
|
||||
free(reencoded);
|
||||
}
|
||||
|
Reference in New Issue
Block a user