From patchwork Thu Jan 24 12:34:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 10778861 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 DAA331390 for ; Thu, 24 Jan 2019 12:34:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7B8A2CC1A for ; Thu, 24 Jan 2019 12:34:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB64A2E49E; Thu, 24 Jan 2019 12:34:54 +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=-7.9 required=2.0 tests=BAYES_00,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 5BE8D2CC1A for ; Thu, 24 Jan 2019 12:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727665AbfAXMex (ORCPT ); Thu, 24 Jan 2019 07:34:53 -0500 Received: from cloud.peff.net ([104.130.231.41]:47124 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1727386AbfAXMew (ORCPT ); Thu, 24 Jan 2019 07:34:52 -0500 Received: (qmail 25876 invoked by uid 109); 24 Jan 2019 12:34:52 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Thu, 24 Jan 2019 12:34:52 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 27992 invoked by uid 111); 24 Jan 2019 12:34:57 -0000 Received: from sigill.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.7) by peff.net (qpsmtpd/0.94) with (ECDHE-RSA-AES256-GCM-SHA384 encrypted) SMTP; Thu, 24 Jan 2019 07:34:57 -0500 Authentication-Results: peff.net; auth=none Received: by sigill.intra.peff.net (sSMTP sendmail emulation); Thu, 24 Jan 2019 07:34:51 -0500 Date: Thu, 24 Jan 2019 07:34:51 -0500 From: Jeff King To: git@vger.kernel.org Cc: David Turner , Stefan Beller Subject: [PATCH 4/6] combine-diff: treat --shortstat like --stat Message-ID: <20190124123450.GD11354@sigill.intra.peff.net> References: <20190124122603.GA10415@sigill.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20190124122603.GA10415@sigill.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The --stat of a combined diff is defined as the first-parent stat, going all the way back to 965f803c32 (combine-diff: show diffstat with the first parent., 2006-04-17). Naturally, we gave --numstat the same treatment in 74e2abe5b7 (diff --numstat, 2006-10-12). But --shortstat, which is really just the final line of --stat, does nothing, which produces confusing results: $ git show --oneline --stat eab7584e37 eab7584e37 Merge branch 'en/show-ref-doc-fix' Documentation/git-show-ref.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) $ git show --oneline --shortstat eab7584e37 eab7584e37 Merge branch 'en/show-ref-doc-fix' [nothing! We'd expect to see the "1 file changed..." line] This patch teaches combine-diff to treats the two formats identically. Reported-by: David Turner Signed-off-by: Jeff King --- combine-diff.c | 1 + t/t4013-diff-various.sh | 1 + t/t4013/diff.diff-tree_--cc_--shortstat_master | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 t/t4013/diff.diff-tree_--cc_--shortstat_master diff --git a/combine-diff.c b/combine-diff.c index b1d259d5a0..83ec3dfffa 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -1325,6 +1325,7 @@ static const char *path_path(void *obj) * Diff stat formats which we always compute solely against the first parent. */ #define STAT_FORMAT_MASK (DIFF_FORMAT_NUMSTAT \ + | DIFF_FORMAT_SHORTSTAT \ | DIFF_FORMAT_DIFFSTAT) /* find set of paths that every parent touches */ diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 7d985ff6b1..9ccdf08730 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -239,6 +239,7 @@ diff-tree --cc --stat --summary master # stat summary should show the diffstat and summary with the first parent diff-tree -c --stat --summary side diff-tree --cc --stat --summary side +diff-tree --cc --shortstat master # improved by Timo's patch diff-tree --cc --patch-with-stat master # improved by Timo's patch diff --git a/t/t4013/diff.diff-tree_--cc_--shortstat_master b/t/t4013/diff.diff-tree_--cc_--shortstat_master new file mode 100644 index 0000000000..a4ca42df2a --- /dev/null +++ b/t/t4013/diff.diff-tree_--cc_--shortstat_master @@ -0,0 +1,4 @@ +$ git diff-tree --cc --shortstat master +59d314ad6f356dd08601a4cd5e530381da3e3c64 + 2 files changed, 5 insertions(+) +$