git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Bo Yang <struggleyb.nku@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, gitster@pobox.com, trast@student.ethz.ch
Subject: Re: [PATCH 0/6 v2] Make git log --graph looks better with -p and  other diff options
Date: Thu, 20 May 2010 18:49:20 -0700	[thread overview]
Message-ID: <AANLkTim5R94ZmIfujvhky5zFQYT5MIgJJ58tVnjvQkHF@mail.gmail.com> (raw)
In-Reply-To: <20100520132425.GA5504@coredump.intra.peff.net>

Hi Jeff,
On Thu, May 20, 2010 at 6:24 AM, Jeff King <peff@peff.net> 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

      reply	other threads:[~2010-05-21  1:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-20 10:25 [PATCH 0/6 v2] Make git log --graph looks better with -p and other diff options Bo Yang
2010-05-20 10:25 ` [PATCH 1/6 v2] Add a prefix output callback to diff output Bo Yang
2010-05-20 10:25   ` [PATCH 2/6 v2] Output the graph columns at the end of the commit message Bo Yang
2010-05-20 10:25     ` [PATCH 3/6 v2] diff.c: Output the text graph padding before each diff line Bo Yang
2010-05-20 10:25       ` [PATCH 4/6 v2] Emit a whole line once a time Bo Yang
2010-05-20 10:25         ` [PATCH 5/6 v2] Register a callback for graph output Bo Yang
2010-05-20 10:25           ` [PATCH 6/6 v2] Make --color-words work well with --graph Bo Yang
2010-05-20 12:36 ` [PATCH 0/6 v2] Make git log --graph looks better with -p and other diff options Jeff King
2010-05-20 13:24   ` Jeff King
2010-05-21  1:49     ` Bo Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTim5R94ZmIfujvhky5zFQYT5MIgJJ58tVnjvQkHF@mail.gmail.com \
    --to=struggleyb.nku@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).