git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: diffstat summary mode change bug
Date: Wed, 27 Sep 2017 14:09:20 -0700	[thread overview]
Message-ID: <CAGZ79kbCgTNaunfneWHP3xkLeXwW72CZZWs7Sv8A7QL_UYE_HQ@mail.gmail.com> (raw)
In-Reply-To: <CA+55aFxwNOLaoeg64CYb-a6c89ceVbfc0b5vG_WCzyNBwynwfQ@mail.gmail.com>

On Wed, Sep 27, 2017 at 2:02 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> On Wed, Sep 27, 2017 at 1:40 PM, Stefan Beller <sbeller@google.com> wrote:
>>
>> I disagree with this analysis, as the fix you propose adds the
>> new line unconditionally, i.e. this code path would be broken
>> regardless of "show filename or not".
>
> Right. Because it is what we want.
>
> The old code (before that commit) used to have two different cases:
>
>                 fprintf(file, "%s mode change %06o => %06o%c",
> line_prefix, p->one->mode,
>                         p->two->mode, show_name ? ' ' : '\n');
>
> ie if "show_name" was set, it would *not* print a newline, and print a
> space instead.
>
> But then on the very next line, it used to do:
>
>                 if (show_name) {
>                         write_name_quoted(p->two->path, file, '\n');
>
> ie now it prints the filename, and then prints the newline.
>
> End result: it used to *always* print the newline. Either it printed
> it at the end of the mode (for the non-show_name case), or it printed
> it at the end of the filename (for the show_name case).
>
> Your patch removed the '\n' entirely.
>
> My patch makes it unconditional, which it was before your patch (it
> was "conditional" only in where it was printed, not _whether_ it was
> printed).

I agree with this.

>
>> I wonder why our tests failed to tell us about this.
>>
>> Specifically we have t4100/t-apply-4.expect
>>   mode change 100644 => 100755 t/t0000-basic.sh
>>   mode change 100644 => 100755 t/test-lib.sh
>> which would seem to exercise this code path.
>
> That only tests "git apply --stat --summary".
>
> It doesn't test "git diff" at all.
>
> And the "mode change" printout is entirely different code (see apply.c
> vs diff.c).

Why doesn't this surprise me at all?
(Whenever I write emails I assume the best of Gits code base, such
as non-duplicated code. "It's all in the mighty diff machinery".)

In that case let me write a test for this and resubmit
your fix without whitespace mangling.

Thanks,
Stefan

  reply	other threads:[~2017-09-27 21:09 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 18:15 diffstat summary mode change bug Linus Torvalds
2017-09-27 20:40 ` Stefan Beller
2017-09-27 21:02   ` Linus Torvalds
2017-09-27 21:09     ` Stefan Beller [this message]
2017-09-27 21:58       ` [PATCH] diff: correct newline in summary for renamed files Stefan Beller
2017-09-27 22:04         ` Linus Torvalds
2017-09-27 22:09         ` Jeff King
2017-09-27 22:32           ` Jeff King
2017-09-27 22:39             ` Stefan Beller
2017-09-27 22:49               ` Jeff King
2017-09-27 22:51                 ` Stefan Beller
2017-09-27 23:15                   ` Jonathan Nieder
2017-09-27 23:49                   ` Ramsay Jones
2017-09-27 23:57                     ` Stefan Beller
2017-09-28  0:39                       ` Jeff King
2017-09-28  4:14                     ` Junio C Hamano
2017-09-28  0:35                   ` Jeff King
2017-09-27 22:34           ` Stefan Beller
2017-09-28  4:12 ` diffstat summary mode change bug Junio C Hamano

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=CAGZ79kbCgTNaunfneWHP3xkLeXwW72CZZWs7Sv8A7QL_UYE_HQ@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=torvalds@linux-foundation.org \
    /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).