Re: [PATCH 0/6 v2] Make git log --graph looks better with -p and other diff options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jeff,
On Thu, May 20, 2010 at 6:24 AM, Jeff King <peff@xxxxxxxx> wrote:
> On Thu, May 20, 2010 at 08:36:50AM -0400, Jeff King wrote:
>
>>   git log --graph --oneline --summary 212f0ba
>>
>> Summary lines for some reason don't get properly indented or prefixed
>> with branch lines.
>
> This is my naive attempt at fixing it just by copying your other
> changes. However, it seems to sometimes put several copies of the prefix
> in front of summary lines (and sometimes the next commit line!?). So
> clearly there is something about the output prefix code that I don't
> quite understand.

Thanks a lot for reporting this bug. I would not to ignore the
--summary option, :) Thanks again!

> Maybe this is helpful, and maybe not. :)
>
> diff --git a/diff.c b/diff.c
> index 3a1e05a..656f40b 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -3460,27 +3460,41 @@ static void show_rename_copy(FILE *file, const char *renamecopy, struct diff_fil
>        show_mode_change(file, p, 0);
>  }
>
> -static void diff_summary(FILE *file, struct diff_filepair *p)
> +static void diff_summary(struct diff_options *opt, struct diff_filepair *p)
>  {
> +       FILE *file = opt->file;
> +       char *line_prefix = "";
> +
> +       if (opt->output_prefix) {
> +               struct strbuf *buf = opt->output_prefix(file, opt->output_prefix_data);
> +               line_prefix = buf->buf;
> +       }
> +
>        switch(p->status) {
>        case DIFF_STATUS_DELETED:
> +               fputs(line_prefix, file);
>                show_file_mode_name(file, "delete", p->one);
>                break;
>        case DIFF_STATUS_ADDED:
> +               fputs(line_prefix, file);
>                show_file_mode_name(file, "create", p->two);
>                break;
>        case DIFF_STATUS_COPIED:
> +               fputs(line_prefix, file);
>                show_rename_copy(file, "copy", p);
>                break;
>        case DIFF_STATUS_RENAMED:
> +               fputs(line_prefix, file);
>                show_rename_copy(file, "rename", p);
>                break;
>        default:
>                if (p->score) {
> +                       fputs(line_prefix, file);
>                        fputs(" rewrite ", file);
>                        write_name_quoted(p->two->path, file, ' ');
>                        fprintf(file, "(%d%%)\n", similarity_index(p));
>                }
> +               fputs(line_prefix, file);
>                show_mode_change(file, p, !p->score);
>                break;
>        }
> @@ -3692,7 +3706,7 @@ void diff_flush(struct diff_options *options)
>
>        if (output_format & DIFF_FORMAT_SUMMARY && !is_summary_empty(q)) {
>                for (i = 0; i < q->nr; i++)
> -                       diff_summary(options->file, q->queue[i]);
> +                       diff_summary(options, q->queue[i]);
>                separator++;
>        }

Ah, thanks for patch and of course it helps! I have make --summary
works well and make some other changes for the output_prefix call, and
I will resend the series later. Thanks!

Regards!
Bo
-- 
My blog: http://blog.morebits.org
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]