use get_cached_commit_buffer where appropriate
authorJeff King <peff@peff.net>
Tue, 10 Jun 2014 21:40:46 +0000 (17:40 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 Jun 2014 19:08:17 +0000 (12:08 -0700)
Some call sites check commit->buffer to see whether we have
a cached buffer, and if so, do some work with it. In the
long run we may want to switch these code paths to make
their decision on a different boolean flag (because checking
the cache may get a little more expensive in the future).
But for now, we can easily support them by converting the
calls to use get_cached_commit_buffer.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rev-list.c
log-tree.c
object.c
index e012ebe502cf57467fceb14ea3e01f30cd979313..3fcbf21c03a37b78edacca4810defa78c7cea915 100644 (file)
@@ -106,7 +106,7 @@ static void show_commit(struct commit *commit, void *data)
        else
                putchar('\n');
 
-       if (revs->verbose_header && commit->buffer) {
+       if (revs->verbose_header && get_cached_commit_buffer(commit)) {
                struct strbuf buf = STRBUF_INIT;
                struct pretty_print_context ctx = {0};
                ctx.abbrev = revs->abbrev;
index cf2f86c86632c6df8862fc065299e6cc35aa4829..e9ef8abd3712d9f4e7a323730d2d84704fc453d0 100644 (file)
@@ -588,7 +588,7 @@ void show_log(struct rev_info *opt)
                show_mergetag(opt, commit);
        }
 
-       if (!commit->buffer)
+       if (!get_cached_commit_buffer(commit))
                return;
 
        if (opt->show_notes) {
index 44ca6572045e055f21094bf6fffad43ed36da9ca..67b6e3533dafc39c05d3fa8559d2fbe6d2779a65 100644 (file)
--- a/object.c
+++ b/object.c
@@ -197,7 +197,7 @@ struct object *parse_object_buffer(const unsigned char *sha1, enum object_type t
                if (commit) {
                        if (parse_commit_buffer(commit, buffer, size))
                                return NULL;
-                       if (!commit->buffer) {
+                       if (!get_cached_commit_buffer(commit)) {
                                set_commit_buffer(commit, buffer);
                                *eaten_p = 1;
                        }