From patchwork Wed Aug 10 15:46:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940694 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 A77DFC25B07 for ; Wed, 10 Aug 2022 15:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231683AbiHJPq0 (ORCPT ); Wed, 10 Aug 2022 11:46:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbiHJPqX (ORCPT ); Wed, 10 Aug 2022 11:46:23 -0400 Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E90721E24 for ; Wed, 10 Aug 2022 08:46:22 -0700 (PDT) Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1168e046c85so8439559fac.13 for ; Wed, 10 Aug 2022 08:46:22 -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; bh=cJEODe1SqNaPDY+Mrs2e+uqqLwk5Xs04cQ39SgRR6zQ=; b=iPPIC4olh1W95qy/MnCt4s39IDpO8swN2U85DhHmQwyllghG/L/Qmq2rKqdrg7sEKv PS5om4LGDv5FPACBdCzaLEDSpgSJECP0jXKXHRNMOCJO359PsvA9Qq5NKlCmNkUeTkG7 WLy1LVKb35tCi2r+3QbXnF3BJ0SpztqVedZlK631PTjadCij4clKD3Ay2VpN4ovzKCCf LMejdkMG3M9G5RF22op4LO3tTEfNeYp0dxDgDmiMvf8Wk1OlDJLRmH2eYgs/USmG2Y3C BTFjIb2jxpaxHTuMHkq9+iUJhgXpAc6dyEdj395qi8ZVu+bJvXKKqct4OhHG6kv/EmT5 W+HQ== 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; bh=cJEODe1SqNaPDY+Mrs2e+uqqLwk5Xs04cQ39SgRR6zQ=; b=lAbNXh7nDO21TyXDdFLEEAmqMwjWu6MhH+VLey91FF3Mhx3QHoscCWd1wBPI9ouSq4 eI9VNDjHhipsIFvp100zOumcpeNUhAo2gPNhZguRJN+rv31jJsS1jAhT76eRorvkOQVW b/fHXNC+eQTBEGKuFgby3ifNebxUEmt5ic/89kFr2crKovo3XW/ktGTV158GsqMTXGiI D7ImyTob3t8D09rUtXBN8tfVSERt/1KrCQSnWBGpGXwIVwK+sLT6TcmDeM2ViNcasDp6 0mjZJs6oKI3RrSx/yN9Jr8zifAYkylA4g/wJbl1zoGQuLFXcY0klnGiTm8r17uXEl7rR +QJw== X-Gm-Message-State: ACgBeo1SQPP9WdtVc19xE5DaNbHJeeH/yylBWUQpQx4avP8G48AChlma 7u7qajdpvsOHC+f9n99G5VC4+bTGdnQ= X-Google-Smtp-Source: AA6agR5hhyYz2wjEBbLOjwy2XCdMbR7uCoPwQbo3uUPGirL1fQdKNtbkJs1k5PNYYQszObw18pYNDA== X-Received: by 2002:a05:6870:d6a3:b0:10b:df7d:8243 with SMTP id z35-20020a056870d6a300b0010bdf7d8243mr1811156oap.68.1660146381642; Wed, 10 Aug 2022 08:46:21 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id a19-20020a056870619300b0010d4aba3339sm3826302oah.42.2022.08.10.08.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:21 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 1/7] mergetools: vimdiff: fix comment Date: Wed, 10 Aug 2022 10:46:12 -0500 Message-Id: <20220810154618.307275-2-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The name of the variable is wrong, and it can be set to anything, like 1. Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index f770b8fe24..ea416adcaa 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -29,8 +29,8 @@ ################################################################################ debug_print () { - # Send message to stderr if global variable GIT_MERGETOOL_VIMDIFF is set - # to "true" + # Send message to stderr if global variable GIT_MERGETOOL_VIMDIFF_DEBUG + # is set. if test -n "$GIT_MERGETOOL_VIMDIFF_DEBUG" then From patchwork Wed Aug 10 15:46:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940695 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 655A8C00140 for ; Wed, 10 Aug 2022 15:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231940AbiHJPqb (ORCPT ); Wed, 10 Aug 2022 11:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231608AbiHJPqZ (ORCPT ); Wed, 10 Aug 2022 11:46:25 -0400 Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2DD021E24 for ; Wed, 10 Aug 2022 08:46:23 -0700 (PDT) Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-f2a4c51c45so18231641fac.9 for ; Wed, 10 Aug 2022 08:46:23 -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; bh=fvu+Mt2toaxjA4fzlUviFzXlOnYEQ0Dvt/EQgsmGm2A=; b=cCe2xgAC/bkaByev2WYaMsuonneB+BEGRHrjbyBffa6xlWV9+uVC0xfzYRohISdTBe xQKzBtRVBHOjjQUk4FapAmZR2TNKDWFchHzItsP4ZxepO1ArS8sI9mBbkBgU3RG/KPwv Rr81AmLTAp7WEJ8JUaRWsv6sOQ9XJUjr7dlRq1GLUxqWCNecHQHAOnJlgZcR/adkS6yV xOITGgWHV8wjgYXM0GZQ/VCDY7enNrQMSfOaPRsUstBHTK0qC0bYgt7ci521+mkMHC1j 1Q7z6cmRMjWheH2fjbfl3JBkSv090Q+dizZ1NzR+0a5we5wo/VREW6x9MKKrKa+pBHsy WIhQ== 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; bh=fvu+Mt2toaxjA4fzlUviFzXlOnYEQ0Dvt/EQgsmGm2A=; b=OfBURxMus+aBCFjn7vLh5XotRi/74xK2tfAgd5SQ+tVw3e++F2fJzPzDWokLWKqype mdzj06mtbNCliE4AyFWmpIHsJQc1Ls27TMkApdWWUugZJObFS7wfBQInD8qvSsJdHWiS FJnISK94M5ygjJ+liWUi4XrXYuYXt+FR8pfM57z6e0WbWAKzYu7qJIHGJQ3lsrFOsj81 UGz8UwOJqs95yv3Cx2G+6kO3kWt0b/ILWljcEaKAek7q2dMkSLqz7xo+sngv5VoUooCg v9tqPJBgG6p2J5qE5Vd5Bg3njshWZ8r5r0eOtl80L3a49/xh9gBOeNpcUKHxqK/RCdfV iJmA== X-Gm-Message-State: ACgBeo1UersXXxhmkzFSNlS4lVsrjggNtJfXVlf/SEQZ6ygmiJpJYdRd Bz5n0rNwqooq7wwW6r3c+CRAgcLFFxQ= X-Google-Smtp-Source: AA6agR5Gly00Ljw0YFb4ROL7HGJ9K2XZH3eC2mW4jCh7FNNJHejeE/l1him5IFYePKoXKudfkTgbfw== X-Received: by 2002:a05:6870:8328:b0:10c:fdf5:3be2 with SMTP id p40-20020a056870832800b0010cfdf53be2mr1701735oae.4.1660146383191; Wed, 10 Aug 2022 08:46:23 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id w83-20020acadf56000000b00342ff456840sm689090oig.9.2022.08.10.08.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:22 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 2/7] mergetools: vimdiff: make vimdiff3 actually work Date: Wed, 10 Aug 2022 10:46:13 -0500 Message-Id: <20220810154618.307275-3-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When vimdiff3 was added in 7c147b77d3 (mergetools: add vimdiff3 mode, 2014-04-20), the description made clear the intention: It's similar to the default, except that the other windows are hidden. This ensures that removed/added colors are still visible on the main merge window, but the other windows not visible. However, in 0041797449 (vimdiff: new implementation with layout support, 2022-03-30) this was broken by generating a command that never creates windows, and therefore vim never shows the diff. The layout support implementation broke the whole purpose of vimdiff3, and simply shows MERGED, which is no different from simply opening the file with vim. In order to show the diff, the windows need to be created first, and then when they are hidden the diff remains (if hidenoff isn't set), but by setting the `hidden` option the initial buffers are marked as hidden thus making the feature work. Suggested-by: Fernando Ramos Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index ea416adcaa..95d637b997 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -351,7 +351,7 @@ gen_cmd () { # can't simply append the command to the previous "-c" string as # explained here: https://github.com/vim/vim/issues/9076 - FINAL_CMD="-c \"$CMD\" -c \"tabfirst\"" + FINAL_CMD="-c \"set hidden | $CMD\" -c \"tabfirst\"" } @@ -555,22 +555,22 @@ run_unit_tests () { TEST_CASE_15=" (( (LOCAL , BASE , REMOTE) / MERGED)) +(BASE) , LOCAL+ BASE , REMOTE+ (((LOCAL / BASE / REMOTE)) , MERGED ) " TEST_CASE_16="LOCAL,BASE,REMOTE / MERGED + BASE,LOCAL + BASE,REMOTE + (LOCAL / BASE / REMOTE),MERGED" - EXPECTED_CMD_01="-c \"echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_02="-c \"echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_03="-c \"echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_04="-c \"echo | 4b | bufdo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_05="-c \"echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_06="-c \"echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_07="-c \"echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_08="-c \"echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_09="-c \"echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_10="-c \"echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_11="-c \"echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_12="-c \"echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_13="-c \"echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_14="-c \"echo | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_15="-c \"echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_16="-c \"echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_01="-c \"set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_02="-c \"set hidden | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_03="-c \"set hidden | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_04="-c \"set hidden | echo | 4b | bufdo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_05="-c \"set hidden | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_06="-c \"set hidden | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_07="-c \"set hidden | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_08="-c \"set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_09="-c \"set hidden | echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_10="-c \"set hidden | echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_11="-c \"set hidden | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_12="-c \"set hidden | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_13="-c \"set hidden | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_14="-c \"set hidden | echo | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_15="-c \"set hidden | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_16="-c \"set hidden | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_TARGET_01="MERGED" EXPECTED_TARGET_02="LOCAL" @@ -635,7 +635,7 @@ run_unit_tests () { cat >expect <<-\EOF -f -c - echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | tabdo windo diffthis + set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | tabdo windo diffthis -c tabfirst lo cal From patchwork Wed Aug 10 15:46:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940696 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 B2B23C25B07 for ; Wed, 10 Aug 2022 15:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbiHJPqc (ORCPT ); Wed, 10 Aug 2022 11:46:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231571AbiHJPq1 (ORCPT ); Wed, 10 Aug 2022 11:46:27 -0400 Received: from mail-oa1-x31.google.com (mail-oa1-x31.google.com [IPv6:2001:4860:4864:20::31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C30385A156 for ; Wed, 10 Aug 2022 08:46:25 -0700 (PDT) Received: by mail-oa1-x31.google.com with SMTP id 586e51a60fabf-116c7286aaaso2349481fac.11 for ; Wed, 10 Aug 2022 08:46:25 -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; bh=/KsMV8bO28r8XWPibTJUsU4WPAuMb/p+GBwUmaHVRNg=; b=lrzlm+rIkKCFf2aiOZRsT1fqBBZ/wtF+ok/ZPtUdcDpGA+YPE8RjnEBJliCx2ViMYx Y6ZaRBOuRTnzFGse1GhFRs4PWAPpQ4BND/cro1vZatJjnEUA1Jo3chEfeMmie8ZCPTud 33BjPAeWbSE9z784KM/NOgqCPk3edj5It2DtjrxVLFLael66zXYaj67ELB/6xs2Yz4hF AI5+jQptpcGO5jx/oEyoBfsgprEiPfoBOgb47XfqsIoiho9blI4ypr48G/ztbbyu86RX tMOtnwqMihHgpvyfkEc4OTlhNq2Vcy+sOCIaufN8svVTbENXxnkqidf8duLNg+IPwPK+ 8Txw== 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; bh=/KsMV8bO28r8XWPibTJUsU4WPAuMb/p+GBwUmaHVRNg=; b=yL17CkXB6ibxplEd2RooUohQTCQt0Rd/ZW7E8nwDyIwLA7W+HHId8V8Rmt5QTiZOCf ERZtsq96NWBPsxe/j81yKTfMr+gmYHd0gCJ3Ho/Snq5GT9sXv6CRBg9VVeSpScP1UWiV SFr5S6SQjmR6Rf1x887HqcobeMQiwfYuCu7tM0Abz0iZmRlT8ex1gCC5iab3aP/21ufz XbYq5Nm//idnVg/dF0zfHE5OVyqFOSJvqG1suWoqlgvy1x1dLu0rCBitvh79lOLWlVer xKRtOg3wgwGlhljfcW1ghOAdbAv5kqxFpeXajS4bymb6wPrdVE5fzOePCkhvwWs9kgM4 BuZw== X-Gm-Message-State: ACgBeo0AC4M++rTZfKPCZ9mKS2FaqrGbn5EuPs62FbmmHngF8W6j05ox soilHo/0d6PqVK7D/Xd9Y3/I7dgsRjY= X-Google-Smtp-Source: AA6agR6Z48W7WneGNDoEau3YdmtdYK9j5Y/vLCN2UpxTuqems52+D2JDq60QziMgwWUGMPvWqC7/DA== X-Received: by 2002:a05:6870:d683:b0:10d:a90:d4a1 with SMTP id z3-20020a056870d68300b0010d0a90d4a1mr1681561oap.240.1660146384792; Wed, 10 Aug 2022 08:46:24 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id h13-20020a9d798d000000b0061cbd18bd18sm732116otm.45.2022.08.10.08.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:24 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 3/7] mergetools: vimdiff: silence annoying messages Date: Wed, 10 Aug 2022 10:46:14 -0500 Message-Id: <20220810154618.307275-4-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When using the single window mode we are greeted with the following warning: "./content_LOCAL_8975" 6L, 28B "./content_BASE_8975" 6 lines, 29 bytes "./content_REMOTE_8975" 6 lines, 29 bytes "content" 16 lines, 115 bytes Press ENTER or type command to continue every time. Silence that. Suggested-by: Fernando Ramos Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index 95d637b997..06a7b38841 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -343,7 +343,7 @@ gen_cmd () { then CMD="$CMD | tabdo windo diffthis" else - CMD="$CMD | bufdo diffthis" + CMD="$CMD | silent bufdo diffthis" fi @@ -558,7 +558,7 @@ run_unit_tests () { EXPECTED_CMD_01="-c \"set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_02="-c \"set hidden | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_03="-c \"set hidden | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_04="-c \"set hidden | echo | 4b | bufdo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_04="-c \"set hidden | echo | 4b | silent bufdo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_05="-c \"set hidden | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_06="-c \"set hidden | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_07="-c \"set hidden | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" From patchwork Wed Aug 10 15:46:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940697 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 7DB1BC00140 for ; Wed, 10 Aug 2022 15:46:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231608AbiHJPqd (ORCPT ); Wed, 10 Aug 2022 11:46:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231685AbiHJPqa (ORCPT ); Wed, 10 Aug 2022 11:46:30 -0400 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D29F26565D for ; Wed, 10 Aug 2022 08:46:27 -0700 (PDT) Received: by mail-oi1-x22a.google.com with SMTP id l188so18028168oia.4 for ; Wed, 10 Aug 2022 08:46:27 -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; bh=D62fPlwEP0XCPNqRMMKwc7Br5Fs6K9cqibOGg18QZ5Q=; b=LYN9AdqOXD68tLp8T3/BebHGF4Ufg6BW5ij7i41T1QOiLqgUF6+ONT9HureDuKZ0Es aXAJlVCRdXo2GHtPyck2eOvRLrOLcDAx9JdXYlGA0vEN7vPn536Db5Wx48XscicCcY4d RwGteRMQ2e+P37javJlcOtPUPwR+yOi2J7LVMnW0HQdabNT4zxVF1MDHMLrxUZ8bAZYY 6KpUrQQwRprfMbxnH2U/Chn+O3320vJme0UGXNOGbmY+onBRAsEYOppqLRvdSAHaE0dZ /rziTkvRwSjyEvB/9yMmSswdCAndbveN7Zxp0e4GhD4qZFeLEC8KHX4WHF99qB5T+2xB CcSA== 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; bh=D62fPlwEP0XCPNqRMMKwc7Br5Fs6K9cqibOGg18QZ5Q=; b=zQK5WRIOAXKCkBRIMeU3iYRxR2HulDnmYUzEhCKK2FK4GLKKvY9/H88QDNpvoB99NJ 1Yn779kAewq9owY7f5XuhcNdYsp0EAsxaVKFjOzm7ZoIrv4VSmeJcQhCUrUwlSjZVle8 M9v8HBZHmQmRtYzVzyKqIRxXNN2S4JOZqT7bYPwPF+v+jhwsmdFxMitmO2Kg7+ZZA1PQ IttowPhVTQDnGbJUftLZtD0RhAohfrfiquYQkRMbmC+Up2jH/XXbEu6JW3YoRYpJyDBu S+2ufclUMQiIGnvyp4wSuPj455/lWlvfW5y6wJmji7NRnB1QHTZNpmvvP/NwWC82DBjF ajqA== X-Gm-Message-State: ACgBeo1b+keW0L+hmpD840t4QLhiW4CiQrqQhxN8ac4HwykQfHFKqyFu JAdRNR1MhzyToalspLDrV5CX23R4n9k= X-Google-Smtp-Source: AA6agR6ZGmA0NI2AkRTgKBtCPdcb7sCdUmcEVREL6h5yiEuYjhgOexBQXJJl9D4mJaV6FQqCA/5lmw== X-Received: by 2002:a05:6808:10c2:b0:33a:c862:7083 with SMTP id s2-20020a05680810c200b0033ac8627083mr1712625ois.172.1660146386488; Wed, 10 Aug 2022 08:46:26 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id m12-20020a9d7acc000000b006370abdc976sm706020otn.58.2022.08.10.08.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:25 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 4/7] mergetools: vimdiff: fix for diffopt Date: Wed, 10 Aug 2022 10:46:15 -0500 Message-Id: <20220810154618.307275-5-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When diffopt has hiddenoff set and there's only one window (as is the case in the single window mode) the diff mode is turned off. We don't want that, so turn that option off. Cc: Fernando Ramos Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index 06a7b38841..2ecac41231 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -351,7 +351,7 @@ gen_cmd () { # can't simply append the command to the previous "-c" string as # explained here: https://github.com/vim/vim/issues/9076 - FINAL_CMD="-c \"set hidden | $CMD\" -c \"tabfirst\"" + FINAL_CMD="-c \"set hidden diffopt-=hiddenoff | $CMD\" -c \"tabfirst\"" } @@ -555,22 +555,22 @@ run_unit_tests () { TEST_CASE_15=" (( (LOCAL , BASE , REMOTE) / MERGED)) +(BASE) , LOCAL+ BASE , REMOTE+ (((LOCAL / BASE / REMOTE)) , MERGED ) " TEST_CASE_16="LOCAL,BASE,REMOTE / MERGED + BASE,LOCAL + BASE,REMOTE + (LOCAL / BASE / REMOTE),MERGED" - EXPECTED_CMD_01="-c \"set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_02="-c \"set hidden | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_03="-c \"set hidden | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_04="-c \"set hidden | echo | 4b | silent bufdo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_05="-c \"set hidden | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_06="-c \"set hidden | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_07="-c \"set hidden | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_08="-c \"set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_09="-c \"set hidden | echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_10="-c \"set hidden | echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_11="-c \"set hidden | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_12="-c \"set hidden | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_13="-c \"set hidden | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_14="-c \"set hidden | echo | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_15="-c \"set hidden | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_16="-c \"set hidden | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_01="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_02="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_03="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | 4b | silent bufdo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_05="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_06="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_07="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_08="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_09="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_10="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_11="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_12="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_13="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_14="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_15="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_16="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_TARGET_01="MERGED" EXPECTED_TARGET_02="LOCAL" @@ -635,7 +635,7 @@ run_unit_tests () { cat >expect <<-\EOF -f -c - set hidden | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | tabdo windo diffthis + set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | tabdo windo diffthis -c tabfirst lo cal From patchwork Wed Aug 10 15:46:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940698 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 41687C00140 for ; Wed, 10 Aug 2022 15:46:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231942AbiHJPqh (ORCPT ); Wed, 10 Aug 2022 11:46:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbiHJPqb (ORCPT ); Wed, 10 Aug 2022 11:46:31 -0400 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3935166111 for ; Wed, 10 Aug 2022 08:46:29 -0700 (PDT) Received: by mail-oi1-x232.google.com with SMTP id p132so18120337oif.9 for ; Wed, 10 Aug 2022 08:46:29 -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; bh=N6/+v7YsIIoNLmYY9A8UKjHmigNtTr/t21qDINvV20s=; b=XKVKFoAI2A/We6A4VW4mYJbTkhAyVQa8dm9ClAsHzsm0AnsltCUUoPGYrZHKTHUfA2 gmp4DzpzETCKkSU31TK/xS1xsPfcowxw3KLWSAjHOEM95mgB/pCO5rJoTsj7BmaVNyYU LM7u51ZTvkhPUOxQPXFN1sO51jtmedTG2UmYT8Kdz8t6ZUq4hppuhyhICFVYhNL8Rnlf aU3NumPCZiBeDbsM2ODQqVEhMBQGDwoJwP/eMOTDnkiqJJExib5s1zsXWMNCJ8nd9fFE TZ8bJppHXWFHw9dISfhN/+dyUZsBu3gze5weoRK5hMnevr5PorU7x2khxSIkSqTsMALs sqxQ== 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; bh=N6/+v7YsIIoNLmYY9A8UKjHmigNtTr/t21qDINvV20s=; b=Q7UwyCf8AUXDlKrZB0IyBDOaB7RApge7GtpUCClEIKPNeu5BrzqaRGZiFU4zM3NzCR 2y2S5NZQiH+wNecaAQ5LBmSiS7pMJf/uxZL0EB/fDBmCgT2WhfFcD1bgfbg9Q94XGH8A 4pTQXh0Mg/WI7F394FuB2OSnzayVWDt/XJR+coYoYTtolGeGZu0Sn3TNrkP8GYZ4xlRi NdNO+6hRejJ9UiurVtehjD1GO5jlZtOjTM6cb6FFpKpgxnsXM6NMv+FadNyQ/yNG2KA1 +MpQ5cCtOiYXhF7kwCGQNJOUOJM4bVPjoSBe3bhEnnIk+/lB7UQxSuI4Nt2bmcOjXmia NyZg== X-Gm-Message-State: ACgBeo2Qg+kIJ171OcAIV+p21yF/PD/QXzUqwKgwlO5qNz6rwzcExfIV 6kAll1HJDu2Pq4yBDPg5j91mZgEYMLQ= X-Google-Smtp-Source: AA6agR4Hr4UvdevJc47rXjoYNUVoekKAm/WpP0ncKq9OZg2NBsnWOClG31DYr0gebPVNJwciHgx3SQ== X-Received: by 2002:a54:4e8d:0:b0:325:988d:afaf with SMTP id c13-20020a544e8d000000b00325988dafafmr1589131oiy.135.1660146388141; Wed, 10 Aug 2022 08:46:28 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id h12-20020a056870538c00b0010e00041996sm3862718oan.14.2022.08.10.08.46.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:27 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 5/7] mergetools: vimdiff: rework tab logic Date: Wed, 10 Aug 2022 10:46:16 -0500 Message-Id: <20220810154618.307275-6-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org If we treat tabs especially, the logic becomes much simpler. Cc: Fernando Ramos Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 50 ++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index 2ecac41231..8334871417 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -66,11 +66,6 @@ gen_cmd_aux () { debug_print "LAYOUT : $LAYOUT" debug_print "CMD : $CMD" - if test -z "$CMD" - then - CMD="echo" # vim "nop" operator - fi - start=0 end=${#LAYOUT} @@ -144,11 +139,10 @@ gen_cmd_aux () { # Step 2: # - # Search for all valid separators ("+", "/" or ",") which are *not* + # Search for all valid separators ("/" or ",") which are *not* # inside parenthesis. Save the index at which each of them makes the # first appearance. - index_new_tab="" index_horizontal_split="" index_vertical_split="" @@ -182,14 +176,7 @@ gen_cmd_aux () { then current=$c - if test "$current" = "+" - then - if test -z "$index_new_tab" - then - index_new_tab=$i - fi - - elif test "$current" = "/" + if test "$current" = "/" then if test -z "$index_horizontal_split" then @@ -219,14 +206,7 @@ gen_cmd_aux () { terminate="false" - if ! test -z "$index_new_tab" - then - before="-tabnew" - after="tabnext" - index=$index_new_tab - terminate="true" - - elif ! test -z "$index_horizontal_split" + if ! test -z "$index_horizontal_split" then before="leftabove split" after="wincmd j" @@ -333,7 +313,21 @@ gen_cmd () { # Obtain the first part of vim "-c" option to obtain the desired layout - CMD=$(gen_cmd_aux "$LAYOUT") + CMD= + oldIFS=$IFS + IFS=+ + for tab in $LAYOUT + do + if test -z "$CMD" + then + CMD="echo" # vim "nop" operator + else + CMD="$CMD | tabnew" + fi + + CMD=$(gen_cmd_aux "$tab" "$CMD") + done + IFS=$oldIFS # Adjust the just obtained script depending on whether more than one @@ -565,12 +559,12 @@ run_unit_tests () { EXPECTED_CMD_08="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_09="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_10="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_11="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_11="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_12="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_13="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_14="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_15="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_16="-c \"set hidden diffopt-=hiddenoff | echo | -tabnew | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnext | -tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnext | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_14="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_15="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_16="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_TARGET_01="MERGED" EXPECTED_TARGET_02="LOCAL" From patchwork Wed Aug 10 15:46:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940699 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 A97C2C00140 for ; Wed, 10 Aug 2022 15:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231994AbiHJPqk (ORCPT ); Wed, 10 Aug 2022 11:46:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231952AbiHJPqc (ORCPT ); Wed, 10 Aug 2022 11:46:32 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E989D6B166 for ; Wed, 10 Aug 2022 08:46:30 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id y10-20020a9d634a000000b006167f7ce0c5so10892033otk.0 for ; Wed, 10 Aug 2022 08:46:30 -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; bh=lH/btJU9O5mJV54EpzR0UAG1AVpxRHSJPNS2CqMEN9k=; b=PYQrl+3iAMiNgkjjMklo71PirN/mZmu9r30s83XzeS7vOsoV/7bqn/Y8SR7MbaDIfB JDijxO6gyMWSgb5WjCiyNc6bQyTQo7hxkpKjovMAu5NF6e/b7UgnRdpcTjOAEpAW0WjH 03r0BxA9QZXq/O8tdF0Wt5dR6cMqcnTWcq0C3TdjQcYtenLZdJs97I9YnHrMEpJkC/Ym 6KDVyJrSSmqOr/uIwdfn8Pz4m/GXLlMTXmwqqAqOPYg1kLLyy3ENNo1d7cM7leOPDeA1 iUuu0HDp7JL310XT2WTblayw2Ivogjb0F/7W65tl6uV2mIQZdVmHfcR/x72+xv7IPXub eRSw== 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; bh=lH/btJU9O5mJV54EpzR0UAG1AVpxRHSJPNS2CqMEN9k=; b=Ewn+HH4AbTNCQ4nlhXfdlum+i2y/yZ3wPQqot/aUgbzxVfoqUFd+5TbCThpKUnwSWN sGWw3XFZ22X/y3TLO4uxtHq86+a+CB7CDCx1DcMHz1l7R9jqO/slVvc387RQybuNsZ50 VHxamgRrDhNnjN57vwzr6aDMlmL/tDFZ43ftLwjcPRESfrvDYegFyjhu7MwUivdSAZb1 6KIQhd5gmlhjTFl6S3rVTcEwMrTZi7aDS32yRpaOCfOQx2ZC4YuRPLLit6FZayQtTKsZ JSuLTbTb3ZDGWdGkzGMZ8l6Z4ql2zbWUwe0YR7CovSNBPluDPDpBg1WOQhx7JuL7HfN+ 6+Cg== X-Gm-Message-State: ACgBeo3nA0psJrKJlZSHAYvE4i29R3m0EK7Hl7cf+1eBBWuitDgFN0Aa GfGNQaMaeS5DZrAuW9rHu/PbMGn882Y= X-Google-Smtp-Source: AA6agR77be9Zms0287O5Any6Cz9u9Nzm/8LREcEo/HGHX1PtSggdo9DWZNPWsH7NOO+aQ/arSPCu1Q== X-Received: by 2002:a05:6830:8d:b0:637:1e6c:8975 with SMTP id a13-20020a056830008d00b006371e6c8975mr846633oto.135.1660146389708; Wed, 10 Aug 2022 08:46:29 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id a10-20020aca1a0a000000b003430d6696e8sm688839oia.8.2022.08.10.08.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:29 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 6/7] mergetools: vimdiff: fix single window layouts Date: Wed, 10 Aug 2022 10:46:17 -0500 Message-Id: <20220810154618.307275-7-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Layouts with a single window other than "MERGED" do not work (e.g. "LOCAL" or "MERGED+LOCAL"). This is because as the documentation of bufdo says: The last buffer (or where an error occurred) becomes the current buffer. And we do always do bufdo the end. Additionally, we do it only once, when it should be per tab. Fix this by doing it once per tab right after it's created and before any buffer is switched. Cc: Fernando Ramos Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index 8334871417..e27734b6e7 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -325,21 +325,17 @@ gen_cmd () { CMD="$CMD | tabnew" fi + # If this is a single window diff with all the buffers + if ! echo "$tab" | grep ",\|/" >/dev/null + then + CMD="$CMD | silent execute 'bufdo diffthis'" + fi + CMD=$(gen_cmd_aux "$tab" "$CMD") done IFS=$oldIFS - - # Adjust the just obtained script depending on whether more than one - # windows are visible or not - - if echo "$LAYOUT" | grep ",\|/" >/dev/null - then - CMD="$CMD | tabdo windo diffthis" - else - CMD="$CMD | silent bufdo diffthis" - fi - + CMD="$CMD | tabdo windo diffthis" # Add an extra "-c" option to move to the first tab (notice that we # can't simply append the command to the previous "-c" string as @@ -552,7 +548,7 @@ run_unit_tests () { EXPECTED_CMD_01="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_02="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_03="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | 4b | silent bufdo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | silent execute 'bufdo diffthis' | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_05="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_06="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" EXPECTED_CMD_07="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" From patchwork Wed Aug 10 15:46:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 12940700 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 9E6A2C00140 for ; Wed, 10 Aug 2022 15:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232167AbiHJPqp (ORCPT ); Wed, 10 Aug 2022 11:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbiHJPqd (ORCPT ); Wed, 10 Aug 2022 11:46:33 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1969C6C134 for ; Wed, 10 Aug 2022 08:46:32 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id z22-20020a056830129600b0063711f456ceso2959668otp.7 for ; Wed, 10 Aug 2022 08:46:32 -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; bh=NOw/4aTbF2oYA41XIhgX4HaaR8IyfgJw4zMqrejEcJ8=; b=XQWh2JpHXYucIPTsCPLVoYqYNRepuLEHYZ0fqstUmVXWJQaHy3n6xHXaPTVG0Vn2VL N+5iYB9XQpRGGJfWulaZ7D69/oZbQYQRoJA+/AqeDEDzx4ndk5EeW5pu7d1RwK/wRJLN 0vi6/pIR9Q5nUBTdUzFfblK1gYTtDtwECDpD057CYUu2Mp3AJOiOzxHwF2Ehw3mSWDYk qP3bV4BDPnUzdj+Mw6w/vrno1vT5so9jY78uyWMnRrZb6C2oyFToLEtUIqTD0LIxMGYg /dXMVaNhwZAqZBop7BFfhRxMXBSdCWJTlixLsb180K8elERWxVunvBOKW+njbkTGXFdR wdWA== 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; bh=NOw/4aTbF2oYA41XIhgX4HaaR8IyfgJw4zMqrejEcJ8=; b=3RpAdb366hdbOSHp837W0NQG0pIrELAgBy5ge6eoTz7SNk98PiGBshFLCHXPlMnHUw NkWEITTYy29fFVNjPSWYt8+PrZWYXqEzPREUgFlDVsfWBYCxUIJ23CZL6MeEy7zqqkFK C3M2LL2l0IH0Lm2Yz9K+DySXNJI2c9GFL+S2DBnzIZaULL11bUUixxamWl7h8IuGdmyx ts3rgEH5BUYUMcVGlNQ1NNIT3Dd3owTJBMkSfEdHtG+8YvIL8VT00bXrp1W4Is9a+lHE jV/4q/V+sKdG2anpw/FW9trA5aGGSoOWGA+a+xaWCpLg6UDkdhbrUvtPjDbCSOipfhdO 7c1Q== X-Gm-Message-State: ACgBeo3Co+IKWQfhU7I14ir24TFxZSHjz2M6J92zcpOuHAVG2sZ5VyHP v4WyOAVp9QrkHurebBN6yfQUtlTMDas= X-Google-Smtp-Source: AA6agR6yVVjtGQcsqZb9aLVN6JoOjguG61A4NSWWMfGAoJeJVpt5ECv/yPEL8oz2w2U4fuqi0k9Axw== X-Received: by 2002:a9d:5f16:0:b0:628:192c:dff1 with SMTP id f22-20020a9d5f16000000b00628192cdff1mr10194991oti.126.1660146391090; Wed, 10 Aug 2022 08:46:31 -0700 (PDT) Received: from localhost ([2806:2f0:4060:fff1:4ae7:daff:fe31:3285]) by smtp.gmail.com with ESMTPSA id bi1-20020a056808188100b0033ac7e40050sm658996oib.52.2022.08.10.08.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:46:30 -0700 (PDT) From: Felipe Contreras To: git@vger.kernel.org Cc: Fernando Ramos , Felipe Contreras Subject: [PATCH v4 7/7] mergetools: vimdiff: simplify tabfirst Date: Wed, 10 Aug 2022 10:46:18 -0500 Message-Id: <20220810154618.307275-8-felipe.contreras@gmail.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220810154618.307275-1-felipe.contreras@gmail.com> References: <20220810154618.307275-1-felipe.contreras@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org If we wrap the tabdo command there's no need for a separate command call. Signed-off-by: Felipe Contreras --- mergetools/vimdiff | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index e27734b6e7..06937acbf5 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -335,13 +335,9 @@ gen_cmd () { done IFS=$oldIFS - CMD="$CMD | tabdo windo diffthis" + CMD="$CMD | execute 'tabdo windo diffthis'" - # Add an extra "-c" option to move to the first tab (notice that we - # can't simply append the command to the previous "-c" string as - # explained here: https://github.com/vim/vim/issues/9076 - - FINAL_CMD="-c \"set hidden diffopt-=hiddenoff | $CMD\" -c \"tabfirst\"" + FINAL_CMD="-c \"set hidden diffopt-=hiddenoff | $CMD | tabfirst\"" } @@ -545,22 +541,22 @@ run_unit_tests () { TEST_CASE_15=" (( (LOCAL , BASE , REMOTE) / MERGED)) +(BASE) , LOCAL+ BASE , REMOTE+ (((LOCAL / BASE / REMOTE)) , MERGED ) " TEST_CASE_16="LOCAL,BASE,REMOTE / MERGED + BASE,LOCAL + BASE,REMOTE + (LOCAL / BASE / REMOTE),MERGED" - EXPECTED_CMD_01="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_02="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_03="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | silent execute 'bufdo diffthis' | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_05="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_06="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_07="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_08="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_09="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_10="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_11="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_12="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_13="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_14="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_15="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" - EXPECTED_CMD_16="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | tabdo windo diffthis\" -c \"tabfirst\"" + EXPECTED_CMD_01="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_02="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | 3b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_03="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 4b | wincmd l | 3b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_04="-c \"set hidden diffopt-=hiddenoff | echo | silent execute 'bufdo diffthis' | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_05="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 1b | wincmd j | leftabove split | 4b | wincmd j | 3b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_06="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_07="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 4b | wincmd l | leftabove split | 1b | wincmd j | 3b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_08="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_09="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | 4b | wincmd j | leftabove vertical split | 1b | wincmd l | 3b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_10="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_11="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_12="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_13="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | leftabove split | leftabove vertical split | 1b | wincmd l | 3b | wincmd j | 2b | wincmd l | leftabove vertical split | leftabove split | 1b | wincmd j | 3b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_14="-c \"set hidden diffopt-=hiddenoff | echo | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_15="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" + EXPECTED_CMD_16="-c \"set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | 2b | wincmd l | 3b | wincmd j | 4b | tabnew | leftabove vertical split | 2b | wincmd l | 1b | tabnew | leftabove vertical split | 2b | wincmd l | 3b | tabnew | leftabove vertical split | leftabove split | 1b | wincmd j | leftabove split | 2b | wincmd j | 3b | wincmd l | 4b | execute 'tabdo windo diffthis' | tabfirst\"" EXPECTED_TARGET_01="MERGED" EXPECTED_TARGET_02="LOCAL" @@ -625,9 +621,7 @@ run_unit_tests () { cat >expect <<-\EOF -f -c - set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | tabdo windo diffthis - -c - tabfirst + set hidden diffopt-=hiddenoff | echo | leftabove split | leftabove vertical split | 1b | wincmd l | leftabove vertical split | quit | wincmd l | 2b | wincmd j | 3b | execute 'tabdo windo diffthis' | tabfirst lo cal ' ' mer ged