Merge branch 'jc/simpack' into next
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index 5cb0d32070bfdc067ac02c4a5186c3f2db3d5619..78ed403ed121a84c3efe3a57fa7c24486d724953 100644 (file)
--- a/git.c
+++ b/git.c
@@ -354,7 +354,7 @@ static int cmd_log(int argc, const char **argv, char **envp)
        prepare_revision_walk(&rev);
        setup_pager();
        while ((commit = get_revision(&rev)) != NULL) {
-               if (commit_format != CMIT_FMT_ONELINE && shown)
+               if (shown && do_diff && commit_format != CMIT_FMT_ONELINE)
                        putchar('\n');
                fputs(commit_prefix, stdout);
                if (abbrev_commit && abbrev)
@@ -391,6 +391,8 @@ static int cmd_log(int argc, const char **argv, char **envp)
                if (do_diff)
                        log_tree_commit(&opt, commit);
                shown = 1;
+               free(commit->buffer);
+               commit->buffer = NULL;
        }
        free(buf);
        return 0;