From patchwork Wed Sep 14 19:31:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 12976525 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81E34ECAAD3 for ; Wed, 14 Sep 2022 19:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbiINTbU (ORCPT ); Wed, 14 Sep 2022 15:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbiINTbS (ORCPT ); Wed, 14 Sep 2022 15:31:18 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F37443327 for ; Wed, 14 Sep 2022 12:31:16 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id s6so15587845lfo.7 for ; Wed, 14 Sep 2022 12:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=tUlvv27B7qEZlXTXrnTfEI27f0yt1Pxq7vxRgkjzM2g=; b=TY2432IdInNXWhFcuZwUj1pQXbJHXxCpZpNipxZO7etc7CdX+ArsiiMzgioHCaPFiS aKOj7/cggjOFfPHrzi8/qlVmtf5sNGQqig/uVQbHPCzugDxnRRpaN5nrFAnxgagqUjKK rHxzCeFZOn5oppcrbDYxQjK+Eywm0UYEGKpAWgDYhHUX1pFf0jcPiPwf60XnU2MO5EGS IT9kOPDpSGexdNkFT0y6F7G8IbUO7t/yOr6uPlqdtiIye+nDBNp1AbmKaYQzkhRbaG6W yaGL4Utc2bNHsF0DSpUDzpZkThX4cTqhB4k/nhKJqE4NmaSdMXg2zu0YhBsZji4KJKWt v1Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=tUlvv27B7qEZlXTXrnTfEI27f0yt1Pxq7vxRgkjzM2g=; b=Hnf0YyHZfSCr5uBBIrxriFLv4tfAJRR6J5b7A7FYZ5MMmllmd6YSIE5IJOutW7hblX kk/ImNVwv6MO93NvI3kqbIi9eBHd8JJaAWBYNR/o886iPfI0ThPprep12/im3XK4I4ZC X0FOacSMseBSmioJJ/I0r7Z8+JSa+zfr0WJcxRnndIBtWZc/XcuQRLWUbpzkq9ZDGyQD qIf1knKVuoZk9k8FdmFRA4HkCg/DF135s0Hd0uKbQQnu9DZdxNpAngP4ChZgl7Kvm9+w /vltQC0uLty8kRipuY20l2qBv6XPbo72tgd0wsNS8o0ryWumyAgzwCHaYlxphn5JQkG0 qUdw== X-Gm-Message-State: ACgBeo1ojUkcytDlWZV+RdrJLZ9SsQe6l0nrgIHI9t08u8tvxCZLTvtP agLVIWJ7WtJYZBGkhAP38ohM6g5O4NM= X-Google-Smtp-Source: AA6agR7Lo6DKteFV242XRleVJJQUkVx1auHJAi8qnXCOW7kv+YNr5G/xHrUEnBYEtHTTPPduS3pNHg== X-Received: by 2002:a05:6512:681:b0:489:d509:e076 with SMTP id t1-20020a056512068100b00489d509e076mr13937149lfe.618.1663183874586; Wed, 14 Sep 2022 12:31:14 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id u3-20020a05651220c300b0048ad4c718f3sm2522305lfr.30.2022.09.14.12.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 12:31:14 -0700 (PDT) From: Sergey Organov To: Junio C Hamano Cc: git@vger.kernel.org, Sergey Organov Subject: [PATCH 1/3] diff-merges: cleanup func_by_opt() Date: Wed, 14 Sep 2022 22:31:00 +0300 Message-Id: <20220914193102.5275-2-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220914193102.5275-1-sorganov@gmail.com> References: <20220914193102.5275-1-sorganov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Get rid of unneeded "else" statements in func_by_opt(). Signed-off-by: Sergey Organov --- diff-merges.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/diff-merges.c b/diff-merges.c index 7f64156b8bfe..780ed08fc87f 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -60,15 +60,15 @@ static diff_merges_setup_func_t func_by_opt(const char *optarg) return suppress; if (!strcmp(optarg, "1") || !strcmp(optarg, "first-parent")) return set_first_parent; - else if (!strcmp(optarg, "separate")) + if (!strcmp(optarg, "separate")) return set_separate; - else if (!strcmp(optarg, "c") || !strcmp(optarg, "combined")) + if (!strcmp(optarg, "c") || !strcmp(optarg, "combined")) return set_combined; - else if (!strcmp(optarg, "cc") || !strcmp(optarg, "dense-combined")) + if (!strcmp(optarg, "cc") || !strcmp(optarg, "dense-combined")) return set_dense_combined; - else if (!strcmp(optarg, "r") || !strcmp(optarg, "remerge")) + if (!strcmp(optarg, "r") || !strcmp(optarg, "remerge")) return set_remerge_diff; - else if (!strcmp(optarg, "m") || !strcmp(optarg, "on")) + if (!strcmp(optarg, "m") || !strcmp(optarg, "on")) return set_to_default; return NULL; } From patchwork Wed Sep 14 19:31:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 12976526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA1A4ECAAD3 for ; Wed, 14 Sep 2022 19:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbiINTbX (ORCPT ); Wed, 14 Sep 2022 15:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiINTbS (ORCPT ); Wed, 14 Sep 2022 15:31:18 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72F056DAD8 for ; Wed, 14 Sep 2022 12:31:17 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id a14so17385587ljj.8 for ; Wed, 14 Sep 2022 12:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=a67sK+msJDeWV6TfnbTlt+U+XbR7a5Z7mv0i63WkSFA=; b=RMDspkhwRhN2iDufdeKKmJHi7IotdH1YY5iLciGjEBLRP4oEr2vOORdeOjiNprgze2 VcoD2i3lPaa4gK3dsTMEkHpFN1WJkvUlyerGeKNx26fud27qrYV01d7haUmP1wCWrnDd 2k9BANpavxvn5qpbfwrAmdm+6ublTSzMM6vmUnZ4SEI4wOE/sCsQTXJDi3Az/CbjR3Ed iyFYtdcw6BDFtv1RTPnW6R0Z0BDf3Un14gtr8AASz06CAxYWSgI3HwkZe5gFutwYaiQM n+uyfQYnv+nrMTbksoJhSjSWjyEAQrBndz1MhOzekTbRLiGCRImB687Hj9k/zkRgZGGN GWlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=a67sK+msJDeWV6TfnbTlt+U+XbR7a5Z7mv0i63WkSFA=; b=rT9wvSoFQSZ4T0ZOPAmsHjnemKV/ingnSTKbraFGL8hqyrFchnpjTKjJWTTbKzpRro iF/MMXiPHTYL1X3QPqLF5OzimN9VmwtSOrgpt30MBZXZSNij4HGxUAg9npiw4iUOfEIx EAq/fYLa6GD23ei2EMcJnwohWKzGpAT7lcaic5DKYt1yb+k9/8purEKkK1stdIXxvyTg pklBx4CFDKL6N3vFQSqUx+HpLBfh+m43JAD1NTaQV6Bl0Ok0f9YsWQe4TiC/wnSA8mwq 1Te+K87VETBHRUoXuoSJybtbHNCovTzqrR7nA5m69t842oPFWa1To7agO5dtQdtYN1OH zrtA== X-Gm-Message-State: ACgBeo2WoGOwMAF2V8CwIxa4wGrCN4LOytXy685sl9bgTlqTnlFzkMrn rg/pYmr/Z1YUNYdOmuY2b3k= X-Google-Smtp-Source: AA6agR5WLMMydg3+GJQzlRsOpyunatZAyT32ptg29FZJJuQMcR3AtLDPJtWSfikn8i3Sm295Ef2Qrw== X-Received: by 2002:a05:651c:101:b0:250:896d:f870 with SMTP id a1-20020a05651c010100b00250896df870mr12068861ljb.235.1663183875832; Wed, 14 Sep 2022 12:31:15 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id u3-20020a05651220c300b0048ad4c718f3sm2522305lfr.30.2022.09.14.12.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 12:31:15 -0700 (PDT) From: Sergey Organov To: Junio C Hamano Cc: git@vger.kernel.org, Sergey Organov Subject: [PATCH 2/3] diff-merges: cleanup set_diff_merges() Date: Wed, 14 Sep 2022 22:31:01 +0300 Message-Id: <20220914193102.5275-3-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220914193102.5275-1-sorganov@gmail.com> References: <20220914193102.5275-1-sorganov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Get rid of special-casing of 'suppress' in set_diff_merges(). Instead set 'merges_need_diff' flag correctly in every option handling function. Signed-off-by: Sergey Organov --- diff-merges.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/diff-merges.c b/diff-merges.c index 780ed08fc87f..85cbefa5afd7 100644 --- a/diff-merges.c +++ b/diff-merges.c @@ -20,9 +20,20 @@ static void suppress(struct rev_info *revs) revs->remerge_diff = 0; } +static void common_setup(struct rev_info *revs) +{ + suppress(revs); + revs->merges_need_diff = 1; +} + +static void set_none(struct rev_info *revs) +{ + suppress(revs); +} + static void set_separate(struct rev_info *revs) { - suppress(revs); + common_setup(revs); revs->separate_merges = 1; revs->simplify_history = 0; } @@ -35,21 +46,21 @@ static void set_first_parent(struct rev_info *revs) static void set_combined(struct rev_info *revs) { - suppress(revs); + common_setup(revs); revs->combine_merges = 1; revs->dense_combined_merges = 0; } static void set_dense_combined(struct rev_info *revs) { - suppress(revs); + common_setup(revs); revs->combine_merges = 1; revs->dense_combined_merges = 1; } static void set_remerge_diff(struct rev_info *revs) { - suppress(revs); + common_setup(revs); revs->remerge_diff = 1; revs->simplify_history = 0; } @@ -57,7 +68,7 @@ static void set_remerge_diff(struct rev_info *revs) static diff_merges_setup_func_t func_by_opt(const char *optarg) { if (!strcmp(optarg, "off") || !strcmp(optarg, "none")) - return suppress; + return set_none; if (!strcmp(optarg, "1") || !strcmp(optarg, "first-parent")) return set_first_parent; if (!strcmp(optarg, "separate")) @@ -81,10 +92,6 @@ static void set_diff_merges(struct rev_info *revs, const char *optarg) die(_("invalid value for '%s': '%s'"), "--diff-merges", optarg); func(revs); - - /* NOTE: the merges_need_diff flag is cleared by func() call */ - if (func != suppress) - revs->merges_need_diff = 1; } /* @@ -115,6 +122,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv) if (!suppress_m_parsing && !strcmp(arg, "-m")) { set_to_default(revs); + revs->merges_need_diff = 0; } else if (!strcmp(arg, "-c")) { set_combined(revs); revs->merges_imply_patch = 1; @@ -125,7 +133,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv) set_remerge_diff(revs); revs->merges_imply_patch = 1; } else if (!strcmp(arg, "--no-diff-merges")) { - suppress(revs); + set_none(revs); } else if (!strcmp(arg, "--combined-all-paths")) { revs->combined_all_paths = 1; } else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) { @@ -139,7 +147,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv) void diff_merges_suppress(struct rev_info *revs) { - suppress(revs); + set_none(revs); } void diff_merges_default_to_first_parent(struct rev_info *revs) From patchwork Wed Sep 14 19:31:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Organov X-Patchwork-Id: 12976527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B1DEC6FA86 for ; Wed, 14 Sep 2022 19:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbiINTbY (ORCPT ); Wed, 14 Sep 2022 15:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbiINTbU (ORCPT ); Wed, 14 Sep 2022 15:31:20 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CEE857CB for ; Wed, 14 Sep 2022 12:31:18 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id s6so15587981lfo.7 for ; Wed, 14 Sep 2022 12:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=5E/61Cn98Fl6nCBQNTD8VxesLFg633aWZ+2DTu9sp4c=; b=CzpTkguaHiJR9RGYeANxyUZPkZaKDJGRrhTpupIMvg8Rx+OAaFKyNmoWLjTzqrYJa8 bgC+s3tzkEuWI1JhFJ/jv4a/GZVhQfQy7Pv2CVWrJrb13nrEjk1K2A016rtGRPXEtT69 wHBziRgYHK5jeEBvMObkdTWve6wtZ1hw8EPUlXCjGx918F9f+npuupy2vnB3ejwotBY6 B6madaLlh9LQKZF7oHMfU8dKBMOC4KwbnBCo3Jwv/+szQ1l3sGLUGgFDApMvirbzgPZO vIsttnxO6kM5M2FlA+wrdWVQiDhBouh1cmJXlVRhr1Ll1b1Bjbp3hdZBOAn2OOi4ig9p a1Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=5E/61Cn98Fl6nCBQNTD8VxesLFg633aWZ+2DTu9sp4c=; b=K6XUo6+aLZCXAVhGMql5/MbqrjbHEvXMHvkFwp0SOJoO8FeDHPoWGXeWmo4YuAYUs+ z+Nv0NlrjZaFUglgizVH055LCT8M2O9lAJoIr/LCKifvq6x2PoI6BeTo5NErAAwQ3Y5F HptDRr0UcsZz8Lxuh9yBnCHWG5G7HtqfjdjvDjr8GIeMasM7W+hzAOV2u5IlbG57mnIi VRpY+jyrGKQBOJECs1mVeoTyuxbOKQD1o+2ggBqkWiCBpXw1+CpQkDINhBILqIHZI7tk IzlycoQtxB9XXOa+58JDv/mbgduEgoT8wckdMwglNrdILDrnKIcOzF0GKQ1GWxY8cd4Q 2ROw== X-Gm-Message-State: ACrzQf1juoR00C8acZg9cssglGp02B4UE5x5Ppnm4a4JiQ3/BNE57GBU bPpj8rqsC7Eg/2oXgaTW9Aw= X-Google-Smtp-Source: AMsMyM6PCkunPEKD/4Ts6m5OpI+iBmcUlzLSqiYPTF6lyerk/39PtfGsRQEJtchxxsOwqGRiJft0Mg== X-Received: by 2002:a05:6512:39c6:b0:49e:75e6:8d4f with SMTP id k6-20020a05651239c600b0049e75e68d4fmr461474lfu.34.1663183877001; Wed, 14 Sep 2022 12:31:17 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id u3-20020a05651220c300b0048ad4c718f3sm2522305lfr.30.2022.09.14.12.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 12:31:16 -0700 (PDT) From: Sergey Organov To: Junio C Hamano Cc: git@vger.kernel.org, Sergey Organov Subject: [PATCH 3/3] diff-merges: clarify log.diffMerges documentation Date: Wed, 14 Sep 2022 22:31:02 +0300 Message-Id: <20220914193102.5275-4-sorganov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220914193102.5275-1-sorganov@gmail.com> References: <20220914193102.5275-1-sorganov@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Signed-off-by: Sergey Organov --- Documentation/config/log.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/config/log.txt b/Documentation/config/log.txt index 5250ba45fb4e..cbe34d759221 100644 --- a/Documentation/config/log.txt +++ b/Documentation/config/log.txt @@ -30,9 +30,9 @@ log.excludeDecoration:: option. log.diffMerges:: - Set default diff format to be used for merge commits. See - `--diff-merges` in linkgit:git-log[1] for details. - Defaults to `separate`. + Set diff format to be used when `--diff-merges=on` is + specified, see `--diff-merges` in linkgit:git-log[1] for + details. Defaults to `separate`. log.follow:: If `true`, `git log` will act as if the `--follow` option was used when