From patchwork Thu Nov 22 21:12:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 10694849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2031814BD for ; Thu, 22 Nov 2018 21:13:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 12F452CEA7 for ; Thu, 22 Nov 2018 21:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 074242CF38; Thu, 22 Nov 2018 21:13:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E628A2CEA7 for ; Thu, 22 Nov 2018 21:13:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438929AbeKWHyM (ORCPT ); Fri, 23 Nov 2018 02:54:12 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:55298 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438808AbeKWHyM (ORCPT ); Fri, 23 Nov 2018 02:54:12 -0500 Received: by mail-wm1-f68.google.com with SMTP id y139so10092601wmc.5 for ; Thu, 22 Nov 2018 13:13:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XE/NOuroZ5a3RmuiOaUeK7iX8UUTyJ0nzuco8TdfAuk=; b=P82sPaCamzaIxM0UBXipIKJMrSItZTkIJkhq5nchTvfB0E8yyDHIYacpU5S9szg5XN J05bzaV8Caz74Jp0XrYA6NUNuSgUbfulwjzn4crue6CXyxxE1BVOZvdOTCZjVheZe970 EE1DOTKQDupYUwme3D8kpXcE4DYZp34OxX4xF7/oM65hCDG2r+HRx3pEmktNOphS/tch E5gipf1I/W1Ol1u4Vjg+4Nh5EWJmyMiOdet/lpW4eHcecq0EkNGk23ztKmOowi3OvUPE 9no4ckLQVQ5/Ruzm/Ga/Zx3q8uoogJy0tMI6eoZFXdoMmneQnoTXbBMSXi5LVmsesoWX dkPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XE/NOuroZ5a3RmuiOaUeK7iX8UUTyJ0nzuco8TdfAuk=; b=kNow9jJ+FVawup1YL9YQ3wemFlikVsmi6vovbqPD9nz/QckqUNOqcRknohciu8fRhL DJ2to12rv/d0bFlzexINZdlHIFRXYysJhTCA7L9XVaaCg4TC1zj1+wvkP/zj+PhnHeQ6 cl/m7WXNodhVWNTmhwIxIOXC5Zpii3p7hQwedhGUt2MbBtC2+Sevpnrd1uJKzh0seQ1S LRr8k3fRnNwkJJVOmFu8pjnZoshkk2kFL3o0zHXEKSSplwJnnw3lOik9b9VMNC9xzLKj dH4GoARrv3tO6kaigAuB8dFbecfvnpDnnpodpQc8JIbBmDXQYtwc5Wd84sZkYHBWqONw cpqw== X-Gm-Message-State: AA+aEWaCQh0kEreyIxPrF8svnVk0fgz6PmQvVAx0gdv7uxtPxbMnmG/6 DRLrDWyoZrYSMfdxKZo0IK9+sgr7nYI= X-Google-Smtp-Source: AFSGD/UfZH8tb5Ut9MDut1JXe+0ZtIQEqgRj2MX223mdf4uCB9cB9tCXzcSSPWwUWMZ7ZbOC27XeVA== X-Received: by 2002:a1c:9d10:: with SMTP id g16mr10743236wme.43.1542921181026; Thu, 22 Nov 2018 13:13:01 -0800 (PST) Received: from u.nix.is ([2a01:4f8:190:5095::2]) by smtp.gmail.com with ESMTPSA id 5sm8775229wmw.8.2018.11.22.13.13.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 13:13:00 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 1/2] format-patch: add a more exhaustive --range-diff test Date: Thu, 22 Nov 2018 21:12:47 +0000 Message-Id: <20181122211248.24546-2-avarab@gmail.com> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change the narrow test added in 31e2617a5f ("format-patch: add --range-diff option to embed diff in cover letter", 2018-07-22) to test the full output. This test would have spotted a regression in the output if it wasn't beating around the bush and tested the full output, let's do that. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t3206-range-diff.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index e497c1358f..0235c038be 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -249,11 +249,28 @@ for prev in topic master..topic do test_expect_success "format-patch --range-diff=$prev" ' git format-patch --stdout --cover-letter --range-diff=$prev \ - master..unmodified >actual && - grep "= 1: .* s/5/A" actual && - grep "= 2: .* s/4/A" actual && - grep "= 3: .* s/11/B" actual && - grep "= 4: .* s/12/B" actual + master..unmodified >actual.raw && + sed -e "s|^:||" -e "s|:$||" >expect <<-\EOF && + :1: 4de457d = 1: 35b9b25 s/5/A/ + : a => b | 0 + : 1 file changed, 0 insertions(+), 0 deletions(-) + : : + :2: fccce22 = 2: de345ab s/4/A/ + : a => b | 0 + : 1 file changed, 0 insertions(+), 0 deletions(-) + : : + :3: 147e64e = 3: 9af6654 s/11/B/ + : a => b | 0 + : 1 file changed, 0 insertions(+), 0 deletions(-) + : : + :4: a63e992 = 4: 2901f77 s/12/B/ + : a => b | 0 + : 1 file changed, 0 insertions(+), 0 deletions(-) + : : + :-- : + EOF + sed -ne "/^1:/,/^--/p" actual && + test_cmp expect actual ' done From patchwork Thu Nov 22 21:12:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 10694851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 757A81926 for ; Thu, 22 Nov 2018 21:13:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6696A2CE6F for ; Thu, 22 Nov 2018 21:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A6F62CF36; Thu, 22 Nov 2018 21:13:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E05892CE6F for ; Thu, 22 Nov 2018 21:13:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438933AbeKWHyN (ORCPT ); Fri, 23 Nov 2018 02:54:13 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37983 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438808AbeKWHyN (ORCPT ); Fri, 23 Nov 2018 02:54:13 -0500 Received: by mail-wm1-f65.google.com with SMTP id k198so10319909wmd.3 for ; Thu, 22 Nov 2018 13:13:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uzQ4gDqjkCHkLOKzqNNwzMilN7RF1xKrUumEdElOjQY=; b=NyZ1IED91AQFlHJt7aulAmwjVHcv5HZj3iluo+gHjFTkIRQiQDpvt+HB11uH9lCiLe zrE7UW7WOGIGTrkUUNHPm+WrqWfE7kwZQaZ9NJjVw2BYx0AtDdF/psUyrDMjSbSVt4ga gX47JKFOa9dR7fBEVVEYCttk2RH4HPPvQqQBeQbgzBmiGgmngxnNE3CyUqZuMhpECdlm 0xK09ei6+j86EFu9YGV0c7DWlDsNywqZqJsR8nN/6JasZ+DXRAyvtvBpRWyzPmz801IX RwxTYOQ6oEo7f7qi+qEHWskbNHb2vlFHU3wYGR6QPv3MYKz6D1UVTaWkQp75c0WvQJ1+ 4lpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uzQ4gDqjkCHkLOKzqNNwzMilN7RF1xKrUumEdElOjQY=; b=cvMPutmeg65LGKzF4X5oxUPQ0om1GWINNc+IhxUvQ0D8ERBKDbpykvqeSBc2w1CWFp 6K8BI2vew2JjhBl2A41SV3eWt2d8U5pK89agbB3eK7S3BFqmyD8FRYEEQh23/KRLSjEf QGoh0wh6sUI0kWJlh65td9kFBLUiRRMMhbJrxMBKdscAJWQm5/xXg2nagkAv6b26MlCg I7HRKtLAqlMmTZQ8NRpPSZodk0sUJxtS1V6wkTbtv3TI38q0sYcsrG/+LMT6jVwRRANu 2Q+3Ar5sESpgYZJCIBA0Yt5W8jS+EjgANBAJm7baJkMigy6eugqEn61krMP7OKQVD9MD syiQ== X-Gm-Message-State: AGRZ1gIGZBjAjqXKMc9fp2v85mv5kMROVMwJAB1PTuld7Wkrso44V3CB cLZ2zJdOYUvTPG81eFwoGonODjx2Cx8= X-Google-Smtp-Source: AFSGD/U1Oo3B4UU5tKN8dfqapqr2B5ySTE8CuGc92V1Q8l+nQQzSSB0PkViTNnp+lTOt8csWabBZeA== X-Received: by 2002:a7b:c397:: with SMTP id s23mr10730991wmj.127.1542921182510; Thu, 22 Nov 2018 13:13:02 -0800 (PST) Received: from u.nix.is ([2a01:4f8:190:5095::2]) by smtp.gmail.com with ESMTPSA id 5sm8775229wmw.8.2018.11.22.13.13.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 13:13:01 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Eric Sunshine , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBC?= =?utf-8?b?amFybWFzb24=?= Subject: [PATCH 2/2] format-patch: don't include --stat with --range-diff output Date: Thu, 22 Nov 2018 21:12:48 +0000 Message-Id: <20181122211248.24546-3-avarab@gmail.com> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix a regression introduced in my a48e12ef7a ("range-diff: make diff option behavior (e.g. --stat) consistent", 2018-11-13). Since the format-patch setup code implicitly sets --stat --summary by default, we started emitting the --stat output in the cover letter's range-diff. As noted in df569c3f31 ("range-diff doc: add a section about output stability", 2018-11-09) the --stat output is currently rather useless, and just adds noise. Perhaps we should detect if --stat or --summary were implicitly passed to format-patch, and then pass them along, but I think fixing it this way is fine. If our --stat output ever becomes useful in range-diff we can revisit this. There's still cases like e.g. --numstat triggering rather useless range-diff output, but I think it's OK to just handle the default case. Users are unlikely to produce a formatted patch with the likes of --numstat, or indeed any other custom diff option except -U or maybe -W. If they need weirder combinations of options they can always manually produce the range-diff. This whole situation comes about because we're assuming that when the user passes along e.g. -U10 that they want that some 10-line context for the range-diff as for the patches themselves. As noted in [1] I think it's worth re-visiting this and making -U10 just apply to the patches, and e.g. --range-diff-U10 to the range-diff. But that's left as a topic for another series less close to a rc2. 1. https://public-inbox.org/git/87d0ri7gbs.fsf@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- builtin/log.c | 7 ++++++- t/t3206-range-diff.sh | 12 ------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/builtin/log.c b/builtin/log.c index 0fe6f9ba1e..7cd2db0be9 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1094,9 +1094,13 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout, } if (rev->rdiff1) { + struct diff_options opts; + memcpy(&opts, &rev->diffopt, sizeof(opts)); + opts.output_format &= ~(DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY); + fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title); show_range_diff(rev->rdiff1, rev->rdiff2, - rev->creation_factor, 1, &rev->diffopt); + rev->creation_factor, 1, &opts); } } @@ -1697,6 +1701,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) if (!use_patch_format && (!rev.diffopt.output_format || rev.diffopt.output_format == DIFF_FORMAT_PATCH)) + /* Needs to be mirrored in show_range_diff() invocation */ rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY; if (!rev.diffopt.stat_width) rev.diffopt.stat_width = MAIL_DEFAULT_WRAP; diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh index 0235c038be..90def330bd 100755 --- a/t/t3206-range-diff.sh +++ b/t/t3206-range-diff.sh @@ -252,21 +252,9 @@ do master..unmodified >actual.raw && sed -e "s|^:||" -e "s|:$||" >expect <<-\EOF && :1: 4de457d = 1: 35b9b25 s/5/A/ - : a => b | 0 - : 1 file changed, 0 insertions(+), 0 deletions(-) - : : :2: fccce22 = 2: de345ab s/4/A/ - : a => b | 0 - : 1 file changed, 0 insertions(+), 0 deletions(-) - : : :3: 147e64e = 3: 9af6654 s/11/B/ - : a => b | 0 - : 1 file changed, 0 insertions(+), 0 deletions(-) - : : :4: a63e992 = 4: 2901f77 s/12/B/ - : a => b | 0 - : 1 file changed, 0 insertions(+), 0 deletions(-) - : : :-- : EOF sed -ne "/^1:/,/^--/p" actual &&