From patchwork Wed Jul 29 20:12:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff King X-Patchwork-Id: 11691659 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85B7E13B6 for ; Wed, 29 Jul 2020 20:12:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E84320809 for ; Wed, 29 Jul 2020 20:12:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726711AbgG2UMV (ORCPT ); Wed, 29 Jul 2020 16:12:21 -0400 Received: from cloud.peff.net ([104.130.231.41]:41528 "EHLO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbgG2UMV (ORCPT ); Wed, 29 Jul 2020 16:12:21 -0400 Received: (qmail 8869 invoked by uid 109); 29 Jul 2020 20:12:21 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 29 Jul 2020 20:12:21 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 7899 invoked by uid 111); 29 Jul 2020 20:12:20 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 29 Jul 2020 16:12:20 -0400 Authentication-Results: peff.net; auth=none Date: Wed, 29 Jul 2020 16:12:20 -0400 From: Jeff King To: git@vger.kernel.org Cc: Junio C Hamano , Chris Torek Subject: [PATCH v2 7/7] doc/git-log: clarify handling of merge commit diffs Message-ID: <20200729201220.GG2989342@coredump.intra.peff.net> References: <20200729201002.GA2989059@coredump.intra.peff.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200729201002.GA2989059@coredump.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org It can be surprising that git-log doesn't show any diff for merge commits by default. Arguably "--cc" would be a reasonable default, but it's very expensive (which is why we turn it on for "git show" but not for "git log"). Let's at least document the current behavior, including the recent "--first-parent implies -m" case Signed-off-by: Jeff King --- Documentation/git-log.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/git-log.txt b/Documentation/git-log.txt index 0a4c99e5f8..9ccba65469 100644 --- a/Documentation/git-log.txt +++ b/Documentation/git-log.txt @@ -117,6 +117,13 @@ DIFF FORMATTING By default, `git log` does not generate any diff output. The options below can be used to show the changes made by each commit. +Note that unless one of `-c`, `--cc`, or `-m` is given, merge commits +will never show a diff, even if a diff format like `--patch` is +selected, nor will they match search options like `-S`. The exception is +when `--first-parent` is in use, in which merges are treated like normal +single-parent commits (this can be overridden by providing a +combined-diff option or with `--no-diff-merges`). + -c:: With this option, diff output for a merge commit shows the differences from each of the parents to the merge result