use get_commit_buffer everywhere
Each of these sites assumes that commit->buffer is valid. Since they would segfault if this was not the case, they are likely to be correct in practice. However, we can future-proof them by using get_commit_buffer. And as a side effect, we abstract away the final bare uses of commit->buffer. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b66103c3ba
commit
bc6b8fc130
@ -190,9 +190,11 @@ static void output_commit_title(struct merge_options *o, struct commit *commit)
|
||||
printf(_("(bad commit)\n"));
|
||||
else {
|
||||
const char *title;
|
||||
int len = find_commit_subject(commit->buffer, &title);
|
||||
const char *msg = get_commit_buffer(commit);
|
||||
int len = find_commit_subject(msg, &title);
|
||||
if (len)
|
||||
printf("%.*s\n", len, title);
|
||||
unuse_commit_buffer(commit, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user