From owner-svn-src-head@freebsd.org Tue Oct 27 12:59:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F020C44CA1E; Tue, 27 Oct 2020 12:59:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CLBcm64x8z4nL4; Tue, 27 Oct 2020 12:59:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id AEF122DBF3; Tue, 27 Oct 2020 12:59:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f51.google.com with SMTP id s17so557848qvr.11; Tue, 27 Oct 2020 05:59:52 -0700 (PDT) X-Gm-Message-State: AOAM530cCW0rTmnuzDaOtTseuAO308jwuHfG1Lshv8rrmUqNt2KEZss6 qRsghvpVRENdVXjUC6zRT7pV2COS1v0yDduT3qI= X-Google-Smtp-Source: ABdhPJxEzPkNQHIafYeSVYSGYpg+SLMjjGoRGxvtg4KP9ByrESvZZ6Oan+9CA4p23E/iv1xV3GcnUksbRJypeApBLx4= X-Received: by 2002:ad4:4e47:: with SMTP id eb7mr2382099qvb.34.1603803592232; Tue, 27 Oct 2020 05:59:52 -0700 (PDT) MIME-Version: 1.0 References: <202010271227.09RCRQEN018075@repo.freebsd.org> <20201027125724.onnk46ruaqyqyizk@ivaldir.net> In-Reply-To: <20201027125724.onnk46ruaqyqyizk@ivaldir.net> From: Kyle Evans Date: Tue, 27 Oct 2020 07:59:40 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r367076 - head/usr.bin/diff To: Baptiste Daroussin Cc: Kyle Evans , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2020 12:59:53 -0000 On Tue, Oct 27, 2020 at 7:57 AM Baptiste Daroussin wrote: > > On Tue, Oct 27, 2020 at 12:27:26PM +0000, Kyle Evans wrote: > > Author: kevans > > Date: Tue Oct 27 12:27:26 2020 > > New Revision: 367076 > > URL: https://svnweb.freebsd.org/changeset/base/367076 > > > > Log: > > diff: don't force the format to 'context' with -p immediately > > > > Instead, leave the fomat as unspecified (if it hasn't been) and use the > > -p flag as a hint to 'context' if no other formatting option is specified. > > > > This fixes `diff -purw`, used frequently by emaste, and matches the behavior > > of its GNU counterpart. > > > > PR: 250015 > > Reviewed by: emaste > > MFC after: 1 week > > > > Modified: > > head/usr.bin/diff/diff.c > > > > Modified: head/usr.bin/diff/diff.c > > ============================================================================== > > --- head/usr.bin/diff/diff.c Tue Oct 27 11:29:11 2020 (r367075) > > +++ head/usr.bin/diff/diff.c Tue Oct 27 12:27:26 2020 (r367076) > > @@ -210,17 +210,6 @@ main(int argc, char **argv) > > diff_format = D_NREVERSE; > > break; > > case 'p': > > - /* > > - * If it's not unset and it's not set to context or > > - * unified, we'll error out here as a conflicting > > - * format. If it's unset, we'll go ahead and set it to > > - * context. > > - */ > > - if (FORMAT_MISMATCHED(D_CONTEXT) && > > - FORMAT_MISMATCHED(D_UNIFIED)) > > - conflicting_format(); > > - if (diff_format == D_UNSET) > > - diff_format = D_CONTEXT; > > dflags |= D_PROTOTYPE; > > break; > > case 'P': > > @@ -320,6 +309,8 @@ main(int argc, char **argv) > > newarg = optind != prevoptind; > > prevoptind = optind; > > } > > + if (diff_format == D_UNSET && (dflags & D_PROTOTYPE) != 0) > > + diff_format = D_CONTEXT; > > if (diff_format == D_UNSET) > > diff_format = D_NORMAL; > > argc -= optind; > > I think it would be great to have a test to ensure we don't break it in the > futur. > Yeah, I had the same thought right after :wq :-) I'll whip up a test this afternoon. Thanks, Kyle Evans