]> git.ipfire.org Git - thirdparty/git.git/blobdiff - log-tree.c
Merge branch 'en/ort-perf-batch-9'
[thirdparty/git.git] / log-tree.c
index 80b8a07ec47da66258b9d918389ecb3e324bc88b..f3178a66a95bb15915eaca9713dc442dd7397984 100644 (file)
@@ -369,8 +369,14 @@ void fmt_output_subject(struct strbuf *filename,
        int start_len = filename->len;
        int max_len = start_len + info->patch_name_max - (strlen(suffix) + 1);
 
-       if (0 < info->reroll_count)
-               strbuf_addf(filename, "v%d-", info->reroll_count);
+       if (info->reroll_count) {
+               struct strbuf temp = STRBUF_INIT;
+
+               strbuf_addf(&temp, "v%s", info->reroll_count);
+               format_sanitized_subject(filename, temp.buf, temp.len);
+               strbuf_addstr(filename, "-");
+               strbuf_release(&temp);
+       }
        strbuf_addf(filename, "%04d-%s", nr, subject);
 
        if (max_len < filename->len)
@@ -963,12 +969,14 @@ static int log_tree_diff(struct rev_info *opt, struct commit *commit, struct log
 int log_tree_commit(struct rev_info *opt, struct commit *commit)
 {
        struct log_info log;
-       int shown, close_file = opt->diffopt.close_file;
+       int shown;
+       /* maybe called by e.g. cmd_log_walk(), maybe stand-alone */
+       int no_free = opt->diffopt.no_free;
 
        log.commit = commit;
        log.parent = NULL;
        opt->loginfo = &log;
-       opt->diffopt.close_file = 0;
+       opt->diffopt.no_free = 1;
 
        if (opt->line_level_traverse)
                return line_log_print(opt, commit);
@@ -985,7 +993,7 @@ int log_tree_commit(struct rev_info *opt, struct commit *commit)
                fprintf(opt->diffopt.file, "\n%s\n", opt->break_bar);
        opt->loginfo = NULL;
        maybe_flush_or_die(opt->diffopt.file, "stdout");
-       if (close_file)
-               fclose(opt->diffopt.file);
+       opt->diffopt.no_free = no_free;
+       diff_free(&opt->diffopt);
        return shown;
 }