From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 1C07C200B9 for ; Thu, 3 May 2018 15:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751140AbeECPbP (ORCPT ); Thu, 3 May 2018 11:31:15 -0400 Received: from mout.gmx.net ([212.227.17.20]:35029 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbeECPbF (ORCPT ); Thu, 3 May 2018 11:31:05 -0400 Received: from virtualbox.mshome.net ([37.201.195.116]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M4Wwq-1eQz1e12K4-00yln0; Thu, 03 May 2018 17:31:02 +0200 From: Johannes Schindelin To: git@vger.kernel.org Cc: Johannes Schindelin , Junio C Hamano , Thomas Rast , Thomas Gummerer , =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Subject: [PATCH 15/18] branch-diff: offer to dual-color the diffs Date: Thu, 3 May 2018 17:31:01 +0200 Message-Id: <2f8017c732fce38f45074125554fddf6e072ea99.1525361419.git.johannes.schindelin@gmx.de> X-Mailer: git-send-email 2.17.0.409.g0f525fc0ba7 In-Reply-To: References: Fcc: Sent Content-Type: text/plain; charset=UTF-8 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:ZFCmS5mcmAMc5oEii9X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Q0e+U Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When showing what changed between old and new commits, we show a diff of the patches. This diff is a diff between diffs, therefore there are nested +/- signs, and it can be relatively hard to understand what is going on. With the --dual-color option, the preimage and the postimage are colored like the diffs they are, and the *outer* +/- sign is inverted for clarity. Signed-off-by: Johannes Schindelin --- builtin/branch-diff.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/builtin/branch-diff.c b/builtin/branch-diff.c index e505b696d11..edf80ecb736 100644 --- a/builtin/branch-diff.c +++ b/builtin/branch-diff.c @@ -432,8 +432,11 @@ int cmd_branch_diff(int argc, const char **argv, const char *prefix) { struct diff_options diffopt = { 0 }; struct strbuf four_spaces = STRBUF_INIT; + int dual_color = 0; double creation_weight = 0.6; struct option options[] = { + OPT_BOOL(0, "dual-color", &dual_color, + N_("color both diff and diff-between-diffs")), OPT_SET_INT(0, "no-patches", &diffopt.output_format, N_("short format (no diffs)"), DIFF_FORMAT_NO_OUTPUT), @@ -469,6 +472,11 @@ int cmd_branch_diff(int argc, const char **argv, const char *prefix) argc = j; diff_setup_done(&diffopt); + if (dual_color) { + diffopt.use_color = 1; + diffopt.flags.dual_color_diffed_diffs = 1; + } + if (argc == 2) { if (!strstr(argv[0], "..")) warning(_("no .. in range: '%s'"), argv[0]); -- 2.17.0.395.g6a618d6010f.dirty