path: root/sequencer.c
diff options
authorJeff King <>2014-06-10 21:41:51 (GMT)
committerJunio C Hamano <>2014-06-13 19:08:17 (GMT)
commitbc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963 (patch)
tree1ba0e495b205f5ad222b426b848a7bae5cf8b265 /sequencer.c
parentb66103c3baa593a39b8b0751213b9fce60e94de4 (diff)
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 <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'sequencer.c')
1 files changed, 3 insertions, 1 deletions
diff --git a/sequencer.c b/sequencer.c
index 7b1f87a..69bcf3d 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -662,10 +662,12 @@ static int format_todo(struct strbuf *buf, struct commit_list *todo_list,
int subject_len;
for (cur = todo_list; cur; cur = cur->next) {
+ const char *commit_buffer = get_commit_buffer(cur->item);
sha1_abbrev = find_unique_abbrev(cur->item->object.sha1, DEFAULT_ABBREV);
- subject_len = find_commit_subject(cur->item->buffer, &subject);
+ subject_len = find_commit_subject(commit_buffer, &subject);
strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
subject_len, subject);
+ unuse_commit_buffer(cur->item, commit_buffer);
return 0;