From: Jack Bates <bk874k@nottheoilrig.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH v4] diff: handle --no-abbrev in no-index case
Date: Thu, 8 Dec 2016 17:22:01 -0700 [thread overview]
Message-ID: <763ddb21-f735-342b-45a4-2f22e03dd346@nottheoilrig.com> (raw)
In-Reply-To: <xmqqtwaerq1x.fsf@gitster.mtv.corp.google.com>
On 08/12/16 03:53 PM, Junio C Hamano wrote:
> Jack Bates <bk874k@nottheoilrig.com> writes:
>> @@ -3364,6 +3365,7 @@ void diff_setup(struct diff_options *options)
>>
>> options->file = stdout;
>>
>> + options->abbrev = DEFAULT_ABBREV;
>
> This is a new change relative to your earlier one.
>
> I looked at all the callers of diff_setup() and noticed that many of
> them were initializing "struct diff_options" that is on-stack that
> is totally uninitialized, which means they were using a completely
> random value that happened to be on the stack.
>
> Which was surprising and made me wonder how the entire "diff" code
> could have ever worked correctly for the past 10 years, as it's not
> like all the users always passed --[no-]abbrev[=<value>] from the
> command line.
>
> In any case, this cannot possibly be introducing a regression; these
> callsites of diff_setup() were starting from a random garbage---now
> they start with -1 in this field. If they were doing the right
> thing by assigning their own abbrev to the field after diff_setup()
> returned, they will continue to do the same, and otherwise they will
> keep doing whatever random things they have been doing when the
> uninitialized field happened to contain -1 the same way.
>
> I didn't look carefully at the additional tests, but the code change
> looks good.
>
> Thanks.
Great, thanks for reviewing it!
prev parent reply other threads:[~2016-12-09 0:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 18:25 [PATCH] diff: handle --no-abbrev outside of repository Jack Bates
2016-11-28 23:03 ` Junio C Hamano
2016-11-29 7:06 ` Jeff King
2016-12-02 18:48 ` [PATCH v2] " Jack Bates
2016-12-05 6:01 ` Jeff King
2016-12-05 6:15 ` Jeff King
2016-12-05 6:58 ` Jeff King
2016-12-06 1:01 ` [PATCH v3] diff: handle --no-abbrev in no-index case Jack Bates
2016-12-06 16:53 ` [PATCH v4] " Jack Bates
2016-12-06 16:56 ` Jack Bates
2016-12-06 17:00 ` Jack Bates
2016-12-08 22:53 ` Junio C Hamano
2016-12-09 0:22 ` Jack Bates [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=763ddb21-f735-342b-45a4-2f22e03dd346@nottheoilrig.com \
--to=bk874k@nottheoilrig.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).