diff options
author | Jeff King <peff@peff.net> | 2014-06-10 17:41:51 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-06-13 12:08:17 -0700 |
commit | bc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963 (patch) | |
tree | 1ba0e495b205f5ad222b426b848a7bae5cf8b265 /builtin/fmt-merge-msg.c | |
parent | b66103c3baa593a39b8b0751213b9fce60e94de4 (diff) | |
download | git-bc6b8fc1300ef79c4b4c3c2a79bb3c1e2e032963.tar.gz |
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 'builtin/fmt-merge-msg.c')
-rw-r--r-- | builtin/fmt-merge-msg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 3906eda877..01f6d59eef 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -230,12 +230,14 @@ static void add_branch_desc(struct strbuf *out, const char *name) static void record_person(int which, struct string_list *people, struct commit *commit) { + const char *buffer; char *name_buf, *name, *name_end; struct string_list_item *elem; const char *field; field = (which == 'a') ? "\nauthor " : "\ncommitter "; - name = strstr(commit->buffer, field); + buffer = get_commit_buffer(commit); + name = strstr(buffer, field); if (!name) return; name += strlen(field); @@ -247,6 +249,7 @@ static void record_person(int which, struct string_list *people, if (name_end < name) return; name_buf = xmemdupz(name, name_end - name + 1); + unuse_commit_buffer(commit, buffer); elem = string_list_lookup(people, name_buf); if (!elem) { |