Code

reduce delta head inflated size
[git.git] / builtin-log.c
index 82c69d1d0593156c5f7034746fe68f5a1a9f7276..9d1ceae44c6a449d2329e897b9705a5b457187f0 100644 (file)
@@ -34,7 +34,6 @@ static int cmd_log_walk(struct rev_info *rev)
        struct commit *commit;
 
        prepare_revision_walk(rev);
-       setup_pager();
        while ((commit = get_revision(rev)) != NULL) {
                log_tree_commit(rev, commit);
                free(commit->buffer);
@@ -102,7 +101,7 @@ static int git_format_config(const char *var, const char *value)
        if (!strcmp(var, "format.headers")) {
                int len = strlen(value);
                extra_headers_size += len + 1;
-               extra_headers = realloc(extra_headers, extra_headers_size);
+               extra_headers = xrealloc(extra_headers, extra_headers_size);
                extra_headers[extra_headers_size - len - 1] = 0;
                strcat(extra_headers, value);
                return 0;
@@ -258,6 +257,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        char message_id[1024];
        char ref_message_id[1024];
 
+       setup_ident();
        git_config(git_format_config);
        init_revisions(&rev, prefix);
        rev.commit_format = CMIT_FMT_EMAIL;
@@ -307,7 +307,6 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                         !strcmp(argv[i], "-s")) {
                        const char *committer;
                        const char *endpos;
-                       setup_ident();
                        committer = git_committer_info(1);
                        endpos = strchr(committer, '>');
                        if (!endpos)
@@ -349,6 +348,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        if (!rev.diffopt.output_format)
                rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
 
+       if (!output_directory)
+               output_directory = prefix;
+
        if (output_directory) {
                if (use_stdout)
                        die("standard output, or directory, which one?");
@@ -382,7 +384,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
                        continue;
 
                nr++;
-               list = realloc(list, nr * sizeof(list[0]));
+               list = xrealloc(list, nr * sizeof(list[0]));
                list[nr - 1] = commit;
        }
        total = nr;