aboutsummaryrefslogtreecommitdiff
path: root/notes-merge.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-06-10 17:41:51 -0400
committerJunio C Hamano <gitster@pobox.com>2014-06-13 12:08:17 -0700
commitbc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963 (patch)
tree1ba0e495b205f5ad222b426b848a7bae5cf8b265 /notes-merge.c
parentb66103c3baa593a39b8b0751213b9fce60e94de4 (diff)
downloadgit-bc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963.tar.gz
git-bc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963.tar.xz
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>
Diffstat (limited to 'notes-merge.c')
-rw-r--r--notes-merge.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/notes-merge.c b/notes-merge.c
index 697cec349..e804db2d0 100644
--- a/notes-merge.c
+++ b/notes-merge.c
@@ -672,7 +672,8 @@ int notes_merge_commit(struct notes_merge_options *o,
DIR *dir;
struct dirent *e;
struct strbuf path = STRBUF_INIT;
- char *msg = strstr(partial_commit->buffer, "\n\n");
+ const char *buffer = get_commit_buffer(partial_commit);
+ const char *msg = strstr(buffer, "\n\n");
int baselen;
strbuf_addstr(&path, git_path(NOTES_MERGE_WORKTREE));
@@ -721,6 +722,7 @@ int notes_merge_commit(struct notes_merge_options *o,
create_notes_commit(partial_tree, partial_commit->parents,
msg, strlen(msg), result_sha1);
+ unuse_commit_buffer(partial_commit, buffer);
if (o->verbosity >= 4)
printf("Finalized notes merge commit: %s\n",
sha1_to_hex(result_sha1));