From patchwork Mon Apr 29 06:21:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921271 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 490FF92A for ; Mon, 29 Apr 2019 06:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34B86285E5 for ; Mon, 29 Apr 2019 06:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 289A2285FD; Mon, 29 Apr 2019 06:21:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 3418E285E5 for ; Mon, 29 Apr 2019 06:21:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727229AbfD2GVH (ORCPT ); Mon, 29 Apr 2019 02:21:07 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:45808 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfD2GVG (ORCPT ); Mon, 29 Apr 2019 02:21:06 -0400 Received: by mail-io1-f65.google.com with SMTP id e8so7935856ioe.12 for ; Sun, 28 Apr 2019 23:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ObA2cx1j6wxGPz5oWbxfF0ep2aRhVnZdLrRiRCdHZxI=; b=t2Qd/FPmwy4JhLub8n3OnRzixtq0+cfweYWu1Z357dmYltDKhcr+qQzU0wO1qK6gcm 87t/QWQSQhjot9GdJ1rbbOv0ZQ+N66hwHg/o4WvHfLdNvHqYX9Wb/PffJOQP0B2oN8L9 JWGgVe7/gAvmgpoVxBehsS9hyYxlgNMRO+XWqmJ7iGAnxTw/Xu2mk18R3oex2HRJCryU N9PY27hQritYHSOqNiZBzqeJgC+sKdJc0PJTEuyfWYEFUl0HcTLJglgeaF6LMMMlSRHy YIrZfdI9cMrapkJpz9+SxA8X2TDzwfg1pOS4vuY+q+9cjI9+jGLAwB+Gn7kcvqzAWUt4 iomw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ObA2cx1j6wxGPz5oWbxfF0ep2aRhVnZdLrRiRCdHZxI=; b=MWyr4xyv5r0hT4CGdln0Cs23v0WCenV6hNrxo00WjQHe0yyXe0Rm74XOJ3UX951YkI 4OvcuSAUHk2PKvnDzReILO83837Q8rHFympubMwgMW3kwD2YCRfKIZRQ8QDWdQrs74Fw gBDeuYRvFtNzpT30+uD19spOimf5nWKEh3iNjpiQ8O0ysWh+f6R7HohWHpqw8+7KbKf+ SF9RY83JsxgtqiELz1xn0MUBN9UkVczcJhTiMaH4WQcVNiqyAHDeDlmYNyWJExo3vXdG r9TMDWBa8wvbuQdkUQdfC9T8WkWWKN3TS6scbLi8Hf6zftPs7xifrjIgJSFi7e8oIEGE hPMg== X-Gm-Message-State: APjAAAUdDZV8UbVxQbyKalAkqzd6Uu+SZ7YTeVsaJL0Kt+xp1Ot2RLdz MEhb/wN35KTOAOp4T1qb/OO+u2W7 X-Google-Smtp-Source: APXvYqwnm1BKcHV1uZ3L/w0tk3gUXXYR4UiESbU++5HGmj+9QsCicFm4B1qe484bNVMnliq2DENvfw== X-Received: by 2002:a5e:8b05:: with SMTP id g5mr12489349iok.274.1556518865381; Sun, 28 Apr 2019 23:21:05 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id t191sm9904611itt.17.2019.04.28.23.21.04 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 23:21:04 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:02 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 1/7] t7610: unsuppress output Message-ID: <9f9922cab341396a846edc2f52342c59d294379a.1556518203.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The output for commands used to be suppressed by redirecting both stdout and stderr to /dev/null. However, this should not happen since the output is useful for debugging and, without the "-v" flag, test scripts don't output anyway. Unsuppress the output by removing the redirections to /dev/null. Signed-off-by: Denton Liu --- t/t7610-mergetool.sh | 122 +++++++++++++++++++++---------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index a9fb971615..69711487dd 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -130,14 +130,14 @@ test_expect_success 'custom mergetool' ' test_when_finished "git reset --hard" && git checkout -b test$test_count branch1 && git submodule update -N && - test_must_fail git merge master >/dev/null 2>&1 && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && + test_must_fail git merge master && + ( yes "" | git mergetool both ) && ( yes "" | git mergetool file1 file1 ) && - ( yes "" | git mergetool file2 "spaced name" >/dev/null 2>&1 ) && - ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) && - ( yes "l" | git mergetool submod >/dev/null 2>&1 ) && + ( yes "" | git mergetool file2 "spaced name" ) && + ( yes "" | git mergetool subdir/file3 ) && + ( yes "d" | git mergetool file11 ) && + ( yes "d" | git mergetool file12 ) && + ( yes "l" | git mergetool submod ) && test "$(cat file1)" = "master updated" && test "$(cat file2)" = "master new" && test "$(cat subdir/file3)" = "master new sub" && @@ -153,15 +153,15 @@ test_expect_success 'mergetool crlf' ' # test_when_finished is LIFO.) test_config core.autocrlf true && git checkout -b test$test_count branch1 && - test_must_fail git merge master >/dev/null 2>&1 && - ( yes "" | git mergetool file1 >/dev/null 2>&1 ) && - ( yes "" | git mergetool file2 >/dev/null 2>&1 ) && - ( yes "" | git mergetool "spaced name" >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "" | git mergetool subdir/file3 >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) && - ( yes "r" | git mergetool submod >/dev/null 2>&1 ) && + test_must_fail git merge master && + ( yes "" | git mergetool file1 ) && + ( yes "" | git mergetool file2 ) && + ( yes "" | git mergetool "spaced name" ) && + ( yes "" | git mergetool both ) && + ( yes "" | git mergetool subdir/file3 ) && + ( yes "d" | git mergetool file11 ) && + ( yes "d" | git mergetool file12 ) && + ( yes "r" | git mergetool submod ) && test "$(printf x | cat file1 -)" = "$(printf "master updated\r\nx")" && test "$(printf x | cat file2 -)" = "$(printf "master new\r\nx")" && test "$(printf x | cat subdir/file3 -)" = "$(printf "master new sub\r\nx")" && @@ -176,8 +176,8 @@ test_expect_success 'mergetool in subdir' ' git submodule update -N && ( cd subdir && - test_must_fail git merge master >/dev/null 2>&1 && - ( yes "" | git mergetool file3 >/dev/null 2>&1 ) && + test_must_fail git merge master && + ( yes "" | git mergetool file3 ) && test "$(cat file3)" = "master new sub" ) ' @@ -188,14 +188,14 @@ test_expect_success 'mergetool on file in parent dir' ' git submodule update -N && ( cd subdir && - test_must_fail git merge master >/dev/null 2>&1 && - ( yes "" | git mergetool file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool ../file1 >/dev/null 2>&1 ) && - ( yes "" | git mergetool ../file2 ../spaced\ name >/dev/null 2>&1 ) && - ( yes "" | git mergetool ../both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool ../file11 >/dev/null 2>&1 ) && - ( yes "d" | git mergetool ../file12 >/dev/null 2>&1 ) && - ( yes "l" | git mergetool ../submod >/dev/null 2>&1 ) && + test_must_fail git merge master && + ( yes "" | git mergetool file3 ) && + ( yes "" | git mergetool ../file1 ) && + ( yes "" | git mergetool ../file2 ../spaced\ name ) && + ( yes "" | git mergetool ../both ) && + ( yes "d" | git mergetool ../file11 ) && + ( yes "d" | git mergetool ../file12 ) && + ( yes "l" | git mergetool ../submod ) && test "$(cat ../file1)" = "master updated" && test "$(cat ../file2)" = "master new" && test "$(cat ../submod/bar)" = "branch1 submodule" && @@ -209,9 +209,9 @@ test_expect_success 'mergetool skips autoresolved' ' git submodule update -N && test_must_fail git merge master && test -n "$(git ls-files -u)" && - ( yes "d" | git mergetool file11 >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file12 >/dev/null 2>&1 ) && - ( yes "l" | git mergetool submod >/dev/null 2>&1 ) && + ( yes "d" | git mergetool file11 ) && + ( yes "d" | git mergetool file12 ) && + ( yes "l" | git mergetool submod ) && output="$(git mergetool --no-prompt)" && test "$output" = "No files need merging" ' @@ -259,9 +259,9 @@ test_expect_success 'mergetool skips resolved paths when rerere is active' ' rm -rf .git/rr-cache && git checkout -b test$test_count branch1 && git submodule update -N && - test_must_fail git merge master >/dev/null 2>&1 && - ( yes "l" | git mergetool --no-prompt submod >/dev/null 2>&1 ) && - ( yes "d" "d" | git mergetool --no-prompt >/dev/null 2>&1 ) && + test_must_fail git merge master && + ( yes "l" | git mergetool --no-prompt submod ) && + ( yes "d" "d" | git mergetool --no-prompt ) && git submodule update -N && output="$(yes "n" | git mergetool --no-prompt)" && test "$output" = "No files need merging" @@ -369,9 +369,9 @@ test_expect_success 'deleted vs modified submodule' ' git checkout -b test$test_count.a test$test_count && test_must_fail git merge master && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "r" | git mergetool submod ) && rmdir submod && mv submod-movedaside submod && test "$(cat submod/bar)" = "branch1 submodule" && @@ -386,9 +386,9 @@ test_expect_success 'deleted vs modified submodule' ' git submodule update -N && test_must_fail git merge master && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "l" | git mergetool submod ) && test ! -e submod && output="$(git mergetool --no-prompt)" && @@ -400,9 +400,9 @@ test_expect_success 'deleted vs modified submodule' ' git submodule update -N && test_must_fail git merge test$test_count && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "r" | git mergetool submod ) && test ! -e submod && test -d submod.orig && @@ -416,9 +416,9 @@ test_expect_success 'deleted vs modified submodule' ' git submodule update -N && test_must_fail git merge test$test_count && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "l" | git mergetool submod ) && test "$(cat submod/bar)" = "master submodule" && git submodule update -N && @@ -440,9 +440,9 @@ test_expect_success 'file vs modified submodule' ' git checkout -b test$test_count.a branch1 && test_must_fail git merge master && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "r" | git mergetool submod ) && rmdir submod && mv submod-movedaside submod && test "$(cat submod/bar)" = "branch1 submodule" && @@ -456,9 +456,9 @@ test_expect_success 'file vs modified submodule' ' git checkout -b test$test_count.b test$test_count && test_must_fail git merge master && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "l" | git mergetool submod ) && git submodule update -N && test "$(cat submod)" = "not a submodule" && @@ -472,9 +472,9 @@ test_expect_success 'file vs modified submodule' ' git submodule update -N && test_must_fail git merge test$test_count && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both >/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "r" | git mergetool submod ) && test -d submod.orig && git submodule update -N && @@ -488,9 +488,9 @@ test_expect_success 'file vs modified submodule' ' git submodule update -N && test_must_fail git merge test$test_count && test -n "$(git ls-files -u)" && - ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 >/dev/null 2>&1 ) && - ( yes "" | git mergetool both>/dev/null 2>&1 ) && - ( yes "d" | git mergetool file11 file12 >/dev/null 2>&1 ) && + ( yes "" | git mergetool file1 file2 spaced\ name subdir/file3 ) && + ( yes "" | git mergetool both ) && + ( yes "d" | git mergetool file11 file12 ) && ( yes "l" | git mergetool submod ) && test "$(cat submod/bar)" = "master submodule" && git submodule update -N && @@ -543,7 +543,7 @@ test_expect_success 'submodule in subdirectory' ' git add subdir/subdir_module && git commit -m "change submodule in subdirectory on test$test_count.b" && - test_must_fail git merge test$test_count.a >/dev/null 2>&1 && + test_must_fail git merge test$test_count.a && ( cd subdir && ( yes "l" | git mergetool subdir_module ) @@ -554,7 +554,7 @@ test_expect_success 'submodule in subdirectory' ' git reset --hard && git submodule update -N && - test_must_fail git merge test$test_count.a >/dev/null 2>&1 && + test_must_fail git merge test$test_count.a && ( yes "r" | git mergetool subdir/subdir_module ) && test "$(cat subdir/subdir_module/file15)" = "test$test_count.b" && git submodule update -N && @@ -641,7 +641,7 @@ test_expect_success 'filenames seen by tools start with ./' ' test_config mergetool.myecho.trustExitCode true && test_must_fail git merge master && git mergetool --no-prompt --tool myecho -- both >actual && - grep ^\./both_LOCAL_ actual >/dev/null + grep ^\./both_LOCAL_ actual ' test_lazy_prereq MKTEMP ' @@ -658,8 +658,8 @@ test_expect_success MKTEMP 'temporary filenames are used with mergetool.writeToT test_config mergetool.myecho.trustExitCode true && test_must_fail git merge master && git mergetool --no-prompt --tool myecho -- both >actual && - ! grep ^\./both_LOCAL_ actual >/dev/null && - grep /both_LOCAL_ actual >/dev/null + ! grep ^\./both_LOCAL_ actual && + grep /both_LOCAL_ actual ' test_expect_success 'diff.orderFile configuration is honored' ' From patchwork Mon Apr 29 06:21:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921273 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 671CC1515 for ; Mon, 29 Apr 2019 06:21:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55D5E285E5 for ; Mon, 29 Apr 2019 06:21:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AB2328608; Mon, 29 Apr 2019 06:21:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 DE423285E5 for ; Mon, 29 Apr 2019 06:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727268AbfD2GVJ (ORCPT ); Mon, 29 Apr 2019 02:21:09 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:50198 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfD2GVJ (ORCPT ); Mon, 29 Apr 2019 02:21:09 -0400 Received: by mail-it1-f196.google.com with SMTP id q14so14657167itk.0 for ; Sun, 28 Apr 2019 23:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=E0K0/ShcR2kASX7X6Zaj6mDUH2T/USNDsLRkTMmYgpQ=; b=o6DTbknkYvGpraKiPI/hAeb7iGq1uGBNskmwYnG1ml9kBGFgANv4NiYzU5ta/N79TJ 3TKSloIRNnB3QOSp6clkmQxUUlePZNkwhF0XRDoyzzPrHnCjYOPGioSPblPm3E1/bCI3 mMJWxPtupSsc+DpOtmPNnSWxl5+r6H0oKjySOiOMsAuzgWagEbLdipz2wdOoGCXcOw4b cmukcGIBkktdQIZGxBk8CnjSJAfbRnTJtDvNua0aahzkp4Vi0eJmzsfJh3z+KqgJivQi 8g2a+tEP3p8nlOjPzqTsut10oUBP9xuVIHz8etOIDeG8tybVQDrB7VhoAqmo3lDpxxdu IZpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=E0K0/ShcR2kASX7X6Zaj6mDUH2T/USNDsLRkTMmYgpQ=; b=fGuiZp7vb3zAyEw803aZWJmTIMe5m/74dFuHI15Xl0+A+dAdMYKyV7DlIwIdgF8BRp IYFRAaBPWj/CC1KrIXUyvhnguSzefL6E5pnQBGv8rRv68trbDhZ4h25mB+snU8npXRj2 LVNXxpaZ1mvYvxgq6tDdUBy4NVvO5gEvsVqYyvuP3JzcUVJiEdd75//YVOV/wX0TambV JJgNEPP8iZGTGwYoafByaJNxO4Z99bphv9rlckPk8clVJaPWEsnDZpt5b1KfNwCYuHbK tk08yos6PAF8WFVcAgROZy61uBEcvKPPvMOwpzGTVexxvs94rDeQG3X6a+1+hVVumMtV zqlw== X-Gm-Message-State: APjAAAXpI6rFJ/IheGywOzA0D/AYW8tCXKhfAlmNLqvLFMMYGH/GBJkM voXTPIErSfNAGchiZCsnUh5uzQ1p X-Google-Smtp-Source: APXvYqy+hkXCkalfAq+9zd8R6wOCbPVgacwoORfdUAkeYATCn5aX8X+FCFwJQOlq0CnuSj3WDMY8dA== X-Received: by 2002:a05:6638:2a4:: with SMTP id d4mr6743603jaq.118.1556518868481; Sun, 28 Apr 2019 23:21:08 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id w81sm14308456itf.23.2019.04.28.23.21.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 28 Apr 2019 23:21:07 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:05 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 2/7] t7610: add mergetool --gui tests Message-ID: <0f632ca6bf4f5e76d18b17435a8e565b4cdc3cc0.1556518203.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In 063f2bdbf7 (mergetool: accept -g/--[no-]gui as arguments, 2018-10-24), mergetool was taught the --gui option but no tests were added to ensure that it was working properly. Add a test to ensure that it works. Signed-off-by: Denton Liu --- t/t7610-mergetool.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index 69711487dd..dad607e186 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -145,6 +145,28 @@ test_expect_success 'custom mergetool' ' git commit -m "branch1 resolved with mergetool" ' +test_expect_success 'gui mergetool' ' + test_config merge.guitool myguitool && + test_config mergetool.myguitool.cmd "(printf \"gui \" && cat \"\$REMOTE\") >\"\$MERGED\"" && + test_config mergetool.myguitool.trustExitCode true && + test_when_finished "git reset --hard" && + git checkout -b test$test_count branch1 && + git submodule update -N && + test_must_fail git merge master && + ( yes "" | git mergetool --gui both ) && + ( yes "" | git mergetool -g file1 file1 ) && + ( yes "" | git mergetool --gui file2 "spaced name" ) && + ( yes "" | git mergetool --gui subdir/file3 ) && + ( yes "d" | git mergetool --gui file11 ) && + ( yes "d" | git mergetool --gui file12 ) && + ( yes "l" | git mergetool --gui submod ) && + test "$(cat file1)" = "gui master updated" && + test "$(cat file2)" = "gui master new" && + test "$(cat subdir/file3)" = "gui master new sub" && + test "$(cat submod/bar)" = "branch1 submodule" && + git commit -m "branch1 resolved with mergetool" +' + test_expect_success 'mergetool crlf' ' test_when_finished "git reset --hard" && # This test_config line must go after the above reset line so that From patchwork Mon Apr 29 06:21:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921275 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 EF23892A for ; Mon, 29 Apr 2019 06:21:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDB28285E5 for ; Mon, 29 Apr 2019 06:21:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D233228608; Mon, 29 Apr 2019 06:21:14 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 5DC81285E5 for ; Mon, 29 Apr 2019 06:21:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727302AbfD2GVN (ORCPT ); Mon, 29 Apr 2019 02:21:13 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:33741 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfD2GVN (ORCPT ); Mon, 29 Apr 2019 02:21:13 -0400 Received: by mail-it1-f194.google.com with SMTP id v8so9933228itf.0 for ; Sun, 28 Apr 2019 23:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=v+UWlS8YOGSQLTUFyQiPowxNYn0OFT8/ZbdQ+V+myGk=; b=H8VKvUbfbnrTanEjBCNbF7OFEv25VGRH9UJD1Tqxy7kCh3s8a7cfy8bvzQ3I0q48Jm FLrIBR2O0m2stdK7dKlXgJtCelg9d/xgWOGOzVbuiqLyIna7n2UNTarqFcjYz0FiLAUH NMjqPgxN3xpvO2oErJI4SU6OFH2m8vIKRFM7nxgJv3UP6cY0ITGoTI4Mea0szh/HkB14 G/rF0HxqiOXLd3n25GGMyW3B4eBbvdmJxXD5ah8rKpD0g+2CxhIMZKayyzpuGn8209Is QIF3zxdfnP3boYXsKcT3nwV8Z6nOZIjg4GjU/t7XcxKx9U8wx+g5Z2vO6teYf+tKOumJ L82w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=v+UWlS8YOGSQLTUFyQiPowxNYn0OFT8/ZbdQ+V+myGk=; b=IdbBdllQ7c46xdMIY3u5cbZZnCMcEDktdCDGPG0QLcSJQwjRXr1a8PrpHLqKhcWRz5 8hcuImS9q+WVb5i4VZFVvWbANwwC+/tkAEPFMszodlsiW1FfzWErEl+s9riwoxvfC2rg QeoamzVyVEoZvAEPqZfNHV8o0qHR1BvIXhyt5/q35U6vjxTUC0+xoNQzZdO4pZuVCUrO EtqLe+Mj+oaENFvTgl+NcvtJVS4cJTbpC/NJBFqEeKgP+i2Vw9sjX0FpfZjOaSmX/sLW 9VQ90I6OGJYT1ZaN4e9cy3qve+pR+HNu+unVJOzCUDaDWZWd6RqLpXQFN0G/9oQqOBMy MtfA== X-Gm-Message-State: APjAAAX5gHF6EQ/5oSzmk0Ojw1qWpBYPXPSuCE5mKqkkPvTfkcKiTc8z xbQ3iLYsDYfw+hUpXi5RSQMaMhrF X-Google-Smtp-Source: APXvYqyI1NF4mWoVz4TxlhgDP2s9tyOP0++Tifjs2+Pm78NN+caSHGPWqgSAx4tFAFoQc17X38STAA== X-Received: by 2002:a24:7a94:: with SMTP id a142mr18685071itc.79.1556518871503; Sun, 28 Apr 2019 23:21:11 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id k17sm1163936ioj.3.2019.04.28.23.21.10 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 23:21:10 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:08 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 3/7] mergetool: use get_merge_tool function Message-ID: <81dd25d8e2bac8c22c018fd35532aaab36526e74.1556518203.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In git-mergetool, the logic for getting which merge tool to use is duplicated in git-mergetool--lib, except for the fact that it needs to know whether the tool was guessed or not. Rewrite `get_merge_tool` to return whether or not the tool was guessed through the return code and make git-mergetool call this function instead of duplicating the logic. Note that 1 was chosen to be the return code of when a tool is guessed because it seems like a slightly more abnormal condition than getting a tool that's explicitly specified but this is completely arbitrary. Also, let `$GIT_MERGETOOL_GUI` be set to determine whether or not the guitool will be selected. This change is not completely backwards compatible as there may be external users of git-mergetool--lib. However, only one user, git-diffall[1], was found from searching GitHub and Google, and this tool is superseded by `git difftool --dir-diff` anyway. It seems very unlikely that there exists an external caller that would take into account the return code of `get_merge_tool` as it would always return 0 before this change so this change probably does not affect any external users. [1]: https://github.com/thenigan/git-diffall Signed-off-by: Denton Liu --- Documentation/git-mergetool--lib.txt | 4 +++- git-difftool--helper.sh | 2 +- git-mergetool--lib.sh | 5 ++++- git-mergetool.sh | 12 ++++-------- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Documentation/git-mergetool--lib.txt b/Documentation/git-mergetool--lib.txt index 055550b2bc..4da9d24096 100644 --- a/Documentation/git-mergetool--lib.txt +++ b/Documentation/git-mergetool--lib.txt @@ -28,7 +28,9 @@ to define the operation mode for the functions listed below. FUNCTIONS --------- get_merge_tool:: - returns a merge tool. + returns a merge tool. the return code is 1 if we returned a guessed + merge tool, else 0. '$GIT_MERGETOOL_GUI' may be set to 'true' to + search for the appropriate guitool. get_merge_tool_cmd:: returns the custom command for a merge tool. diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh index 7bfb6737df..46af3e60b7 100755 --- a/git-difftool--helper.sh +++ b/git-difftool--helper.sh @@ -71,7 +71,7 @@ then then merge_tool="$GIT_DIFF_TOOL" else - merge_tool="$(get_merge_tool)" || exit + merge_tool="$(get_merge_tool)" fi fi diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 83bf52494c..b928179a2e 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -403,14 +403,17 @@ get_merge_tool_path () { } get_merge_tool () { + is_guessed=false # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool) + merge_tool=$(get_configured_merge_tool $GIT_MERGETOOL_GUI) # Try to guess an appropriate merge tool if no tool has been set. if test -z "$merge_tool" then merge_tool=$(guess_merge_tool) || exit + is_guessed=true fi echo "$merge_tool" + test "$is_guessed" = false } mergetool_find_win32_cmd () { diff --git a/git-mergetool.sh b/git-mergetool.sh index 01b9ad59b2..88fa6a914a 100755 --- a/git-mergetool.sh +++ b/git-mergetool.sh @@ -389,7 +389,7 @@ print_noop_and_exit () { main () { prompt=$(git config --bool mergetool.prompt) - gui_tool=false + GIT_MERGETOOL_GUI=false guessed_merge_tool=false orderfile= @@ -416,10 +416,10 @@ main () { esac ;; --no-gui) - gui_tool=false + GIT_MERGETOOL_GUI=false ;; -g|--gui) - gui_tool=true + GIT_MERGETOOL_GUI=true ;; -y|--no-prompt) prompt=false @@ -449,12 +449,8 @@ main () { if test -z "$merge_tool" then - # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool $gui_tool) - # Try to guess an appropriate merge tool if no tool has been set. - if test -z "$merge_tool" + if ! merge_tool=$(get_merge_tool) then - merge_tool=$(guess_merge_tool) || exit guessed_merge_tool=true fi fi From patchwork Mon Apr 29 06:21:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921277 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 E96DF1515 for ; Mon, 29 Apr 2019 06:21:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D84A4285E5 for ; Mon, 29 Apr 2019 06:21:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC6C128608; Mon, 29 Apr 2019 06:21:16 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 73938285E5 for ; Mon, 29 Apr 2019 06:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727321AbfD2GVP (ORCPT ); Mon, 29 Apr 2019 02:21:15 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:40837 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfD2GVP (ORCPT ); Mon, 29 Apr 2019 02:21:15 -0400 Received: by mail-it1-f193.google.com with SMTP id k64so7164143itb.5 for ; Sun, 28 Apr 2019 23:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mzxV7CsL+sGTh03GsLEtneAm0Frke2yHRPGqtbORuSU=; b=QYupVvZ2E19vAPV0xTz9CKKEVQBaekxYi3GZVB2MkcZi1HChw8wf4Y2s1vIDv4VA/J 7rapfVvya29NLdy1JQBlADyJFA/NAP+rdTY7C781BbQHOcNjvAP/HXSUSffHZYeOOYZc n22RHB7HmdpT2kzwwW8kmdOnFOrQke+8g5mWHL3Fov9/JCVKtle4b88YRYelp/mwW4Zv DQpBn7wai5sJL3WIvbnzMZFEMd6wJCpY1xYwvCFOjk5K/96KkV6DJFtcKwPUXZT4hugn iGA8YN9h3bg9PpwkCHnTbABGc4DL+jYT2I265nqXxlxDzBjlf2s0/Y8mJrFnVvqt9LSa +Rsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mzxV7CsL+sGTh03GsLEtneAm0Frke2yHRPGqtbORuSU=; b=jrb5F5GIPNlqapxvQTVb7p0WwvJin5qdv1m6RxjlNtwZQ+waS7z+RIY4JnZ/anAAzJ 1bvKZg52iuWiskf8kOrfDAFvoeSEBQar9nQb63mzKJSqtzsD5inJ56NXg8F94WOmll7w +AoPutBco+O/HvwW/Vq2Kz0sVq61qrW2kyYjoVJ1CKY2i8BF0n3OeTnBfVA9tmOMfaFg GLV9MHShT+s8QRKvQUVFDWj7IW5cS5CYM6y4nnBIAWvL4lSlXFBYubKFLUW93UcXvmEW wYn703lb121SfQdWpQtTnZn7ovGneVOdVfKz4TiVRv9JgnGHbBDB7rhlVho6k0z7GvTm 36GQ== X-Gm-Message-State: APjAAAVesI8foLBkJyNjQKjTk8UThRW5IeeC+jebb6d7Qv07JFxXRNgq OQNgKk/gAPTGdoZZzzyk8Ldy5bAC X-Google-Smtp-Source: APXvYqx8YVkGeS4X/czdR1f16M2JS/aNyxf6PAMLuFilfIgwsQyr5fC8iCc6B5tAwpXQ/Ge+O0UXpw== X-Received: by 2002:a24:480e:: with SMTP id p14mr17083208ita.61.1556518874284; Sun, 28 Apr 2019 23:21:14 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id c72sm15012662itc.22.2019.04.28.23.21.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 23:21:13 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:11 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 4/7] mergetool--lib: create gui_mode function Message-ID: <27a59e1e275f24a857435d3974f1a24fa6a475cd.1556518203.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Before, in `get_configured_merge_tool`, we would test the value of the first argument directly, which corresponded to whether we were using guitool. However, since `$GIT_MERGETOOL_GUI` is available as an environment variable, create the `gui_mode` function which increases the clarify of functions which use it. While we're at it, add a space before `()` in function definitions to fix the style. Signed-off-by: Denton Liu --- git-mergetool--lib.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index b928179a2e..4ca170c8a7 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -80,14 +80,18 @@ show_tool_names () { } } -diff_mode() { +diff_mode () { test "$TOOL_MODE" = diff } -merge_mode() { +merge_mode () { test "$TOOL_MODE" = merge } +gui_mode () { + test "$GIT_MERGETOOL_GUI" = true +} + translate_merge_tool_path () { echo "$1" } @@ -350,8 +354,7 @@ guess_merge_tool () { } get_configured_merge_tool () { - # If first argument is true, find the guitool instead - if test "$1" = true + if gui_mode then gui_prefix=gui fi @@ -405,7 +408,7 @@ get_merge_tool_path () { get_merge_tool () { is_guessed=false # Check if a merge tool has been configured - merge_tool=$(get_configured_merge_tool $GIT_MERGETOOL_GUI) + merge_tool=$(get_configured_merge_tool) # Try to guess an appropriate merge tool if no tool has been set. if test -z "$merge_tool" then From patchwork Mon Apr 29 06:21:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921279 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 AF82692A for ; Mon, 29 Apr 2019 06:21:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DBAF285E5 for ; Mon, 29 Apr 2019 06:21:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9252928608; Mon, 29 Apr 2019 06:21:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 17C40285E5 for ; Mon, 29 Apr 2019 06:21:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727354AbfD2GVT (ORCPT ); Mon, 29 Apr 2019 02:21:19 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:34205 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726137AbfD2GVS (ORCPT ); Mon, 29 Apr 2019 02:21:18 -0400 Received: by mail-io1-f65.google.com with SMTP id h26so8000960ioj.1 for ; Sun, 28 Apr 2019 23:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=NeWaZKf3Ow01SuTlE7rDRsZSrmPzfHC/zeYtkG1Ifew=; b=rJOCIhbEz9FwI0GXltibG7Z2nFwQDeAeSiVhQ2o/n0kB2LkNlyuMpSHjSO4LyIHMZ/ FhocGNMx0eU2EXoSSX5wqystLq47xv3JhEsubL74gxWG2KddC7V3ck/JAcWORaQaXnCs dvhfWF6envRAIzBx6x1mzLu62A5djumu84CZuzGO7iCXj4ahoPgZCRtE+R8J+BSqzXu7 j5I7yLz6CECzqVdnhwBLnzU0CXAUL8fyglLqWfq7zLLSH0vFTwhUiABp2DsnT5+Gvid2 0DSxxhoUaltWQocQZWf2DOSdlpDMAYyrW1yVA3mqM8b5zYyjcUbmHiVkQ/Zu0LcsNlNY Vkrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=NeWaZKf3Ow01SuTlE7rDRsZSrmPzfHC/zeYtkG1Ifew=; b=D8Q3/ZMiL1Oy7T3QpUDFFHBphCpxlU3zlwIHJPMukeMIRYIBWDFkKqDNNI4v+2Un4x /k2JCCEjvU9hW8spw7t84JkPc4GM62Lveg+cOkxvMjVF23UBQ3X8+YmczMGD3RbBhXD1 QtFoS2olT9+732HwYBRUiSogG7uNa7cLWbtGDilzk80ynD8kwzUpbM060EwwZRcKRJrp lkBl7HTqoUoPAd2tyElKtz61EifjRmlujwuA8cSk6g4BLAnXpHc31F099maUr7ZGsNXf yflNgxHK0QcSvvLh+lRrN8Eye3Pjq5iW3LLGz4hCD0UN78uIciQ2WDh8L1nyjuUTEc1t dqww== X-Gm-Message-State: APjAAAUjGzit1nWTvEtf2v/poiV2Z0gc7YUp8rrzvJ8DIviaiIgdGtz/ iRNAOMyIXCDVjUzcGriSUMOk5Yf+ X-Google-Smtp-Source: APXvYqw7uK8apxnfm9m/AZlU6di3LRbSDBpCFBhcv4N7x3fc5kIsteQUU2vMVkqPQxYHbP0KLYtOqA== X-Received: by 2002:a5d:84d9:: with SMTP id z25mr17250971ior.301.1556518877408; Sun, 28 Apr 2019 23:21:17 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id u26sm11834155iob.78.2019.04.28.23.21.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 23:21:16 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:14 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 5/7] mergetool: fallback to tool when guitool unavailable Message-ID: <40413dbda11c282875811a1ddceff7542ae02aa7.1556518203.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In git-difftool, if the tool is called with --gui but `diff.guitool` is not set, it falls back to `diff.tool`. Make git-mergetool also fallback from `merge.guitool` to `merge.tool` if the former is undefined. If git-difftool, when called with `--gui`, were to use `get_configured_mergetool` in a future patch, it would also get the fallback behavior in the following precedence: 1. diff.guitool 2. merge.guitool 3. diff.tool 4. merge.tool The behavior for when difftool or mergetool are called without `--gui` should be identical with or without this patch. Note that the search loop could be written as sections="merge" keys="tool" if diff_mode then sections="diff $sections" fi if gui_mode then keys="guitool $keys" fi merge_tool=$( IFS=' ' for key in $keys do for section in $sections do selected=$(git config $section.$key) if test -n "$selected" then echo "$selected" return fi done done) which would make adding a mode in the future much easier. However, adding a new mode will likely never happen as it is highly discouraged so, as a result, it is written in its current form so that it is more readable for future readers. Signed-off-by: Denton Liu --- Documentation/git-mergetool.txt | 4 +++- git-mergetool--lib.sh | 35 ++++++++++++++++++++++++--------- t/t7610-mergetool.sh | 19 ++++++++++++++++++ 3 files changed, 48 insertions(+), 10 deletions(-) diff --git a/Documentation/git-mergetool.txt b/Documentation/git-mergetool.txt index 0c7975a050..6b14702e78 100644 --- a/Documentation/git-mergetool.txt +++ b/Documentation/git-mergetool.txt @@ -83,7 +83,9 @@ success of the resolution after the custom tool has exited. --gui:: When 'git-mergetool' is invoked with the `-g` or `--gui` option the default merge tool will be read from the configured - `merge.guitool` variable instead of `merge.tool`. + `merge.guitool` variable instead of `merge.tool`. If + `merge.guitool` is not set, we will fallback to the tool + configured under `merge.tool`. --no-gui:: This overrides a previous `-g` or `--gui` setting and reads the diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh index 4ca170c8a7..696eb49160 100644 --- a/git-mergetool--lib.sh +++ b/git-mergetool--lib.sh @@ -354,19 +354,36 @@ guess_merge_tool () { } get_configured_merge_tool () { - if gui_mode - then - gui_prefix=gui - fi - - # Diff mode first tries diff.(gui)tool and falls back to merge.(gui)tool. - # Merge mode only checks merge.(gui)tool + keys= if diff_mode then - merge_tool=$(git config diff.${gui_prefix}tool || git config merge.${gui_prefix}tool) + if gui_mode + then + keys="diff.guitool merge.guitool diff.tool merge.tool" + else + keys="diff.tool merge.tool" + fi else - merge_tool=$(git config merge.${gui_prefix}tool) + if gui_mode + then + keys="merge.guitool merge.tool" + else + keys="merge.tool" + fi fi + + merge_tool=$( + IFS=' ' + for key in $keys + do + selected=$(git config $key) + if test -n "$selected" + then + echo "$selected" + return + fi + done) + if test -n "$merge_tool" && ! valid_tool "$merge_tool" then echo >&2 "git config option $TOOL_MODE.${gui_prefix}tool set to unknown tool: $merge_tool" diff --git a/t/t7610-mergetool.sh b/t/t7610-mergetool.sh index dad607e186..5b61c10a9c 100755 --- a/t/t7610-mergetool.sh +++ b/t/t7610-mergetool.sh @@ -167,6 +167,25 @@ test_expect_success 'gui mergetool' ' git commit -m "branch1 resolved with mergetool" ' +test_expect_success 'gui mergetool without merge.guitool set falls back to merge.tool' ' + test_when_finished "git reset --hard" && + git checkout -b test$test_count branch1 && + git submodule update -N && + test_must_fail git merge master && + ( yes "" | git mergetool --gui both ) && + ( yes "" | git mergetool -g file1 file1 ) && + ( yes "" | git mergetool --gui file2 "spaced name" ) && + ( yes "" | git mergetool --gui subdir/file3 ) && + ( yes "d" | git mergetool --gui file11 ) && + ( yes "d" | git mergetool --gui file12 ) && + ( yes "l" | git mergetool --gui submod ) && + test "$(cat file1)" = "master updated" && + test "$(cat file2)" = "master new" && + test "$(cat subdir/file3)" = "master new sub" && + test "$(cat submod/bar)" = "branch1 submodule" && + git commit -m "branch1 resolved with mergetool" +' + test_expect_success 'mergetool crlf' ' test_when_finished "git reset --hard" && # This test_config line must go after the above reset line so that From patchwork Mon Apr 29 06:21:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921281 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 43E2C1515 for ; Mon, 29 Apr 2019 06:21:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 318DC285E5 for ; Mon, 29 Apr 2019 06:21:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 262CD28608; Mon, 29 Apr 2019 06:21:23 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 C5832285E5 for ; Mon, 29 Apr 2019 06:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727364AbfD2GVV (ORCPT ); Mon, 29 Apr 2019 02:21:21 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:40844 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbfD2GVV (ORCPT ); Mon, 29 Apr 2019 02:21:21 -0400 Received: by mail-it1-f195.google.com with SMTP id k64so7164411itb.5 for ; Sun, 28 Apr 2019 23:21:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BaCYuxcCXPHPmO0EVxeDjh/HLg67x/u8MboMobGV+kA=; b=GAngeAVv/9rTvpM/HMQfNBhq1DYsKP5Oy0MS+SJbVHza2mBRHeQCPnO99pOfOX4qPr Ea7KlpXmG2iv22F1QkLrrNSAt7MwV6ZzQDN41+BYblbtvPICeCOxX4wOBvrPWnvjZyvK ygPR0UIS4MR0B/hR3/ZySI4up3XEFEKlWPXYGvqVDPpaWqB7ZiL8Df5Sr17bPsRpW+RF hyWKjHWLdCaRLO0FaQGpmN1tZwhEY9sXcMSwbeeXsRW/QClM6laVrlgixo96tb/NHXfm 7rc6mT9oln515BKN7md1NDW4Lp2zxZcIZXHIR2kwXijd0F7atdeyqQWEyJEJRS1cgG9x Q3/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BaCYuxcCXPHPmO0EVxeDjh/HLg67x/u8MboMobGV+kA=; b=J+rqrqpk8RePRBSTdt0A3Vffd+He3YDt6HMZuJjQ1RWE+KLx/yGO3+/mKT3aNjvcdy 0q+VjpoPpbpBmwwxJGAFuYKwN4HNwP3zT5VpMfdIKcmw4dNPH/5d06nBRfBOUpXGzjo0 adga3a3R4rGk1HM+WjHf7dVqnn/A7azWhiCJ8mm8OZIyIxdUGihq+aJjYu3ZUrPVnUiG dncyrQifTeR7yac4/frK+pAoaAJ3TLZq2pTHtuqR7quUZlcG5btP/YUcpBnau71SVJHP 68mgbnm6NQhvPlkogz/d5vHfAP4TWKrLMjrJZe8/VIetKVCjMHyoAsdipSnYXpUTSBqe 5LNQ== X-Gm-Message-State: APjAAAUSJIpxmmR4W6FZbGmYqF41nbN0ITWP+9Qstg9tiVfrY79ToZMB ZuMei5IkIm6p2Gy3ZAnoh07pAVvz X-Google-Smtp-Source: APXvYqw6grslJSNN1LrwnbEL2HAhoSZ0u78J4ScgXdxcH3NQcrL2XK04IMXLL7vowPkY63pd6pF+Ow== X-Received: by 2002:a24:2458:: with SMTP id f85mr17151363ita.83.1556518880372; Sun, 28 Apr 2019 23:21:20 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id f14sm12139272ion.46.2019.04.28.23.21.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 23:21:19 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:17 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 6/7] difftool: make --gui, --tool and --extcmd mutually exclusive Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In git-difftool, these options specify which tool to ultimately run. As a result, they are logically conflicting. Explicitly disallow these options from being used together. Signed-off-by: Denton Liu --- builtin/difftool.c | 3 +++ t/t7800-difftool.sh | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/builtin/difftool.c b/builtin/difftool.c index a3ea60ea71..65bba90338 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -731,6 +731,9 @@ int cmd_difftool(int argc, const char **argv, const char *prefix) setenv(GIT_DIR_ENVIRONMENT, absolute_path(get_git_dir()), 1); setenv(GIT_WORK_TREE_ENVIRONMENT, absolute_path(get_git_work_tree()), 1); + if (use_gui_tool + !!difftool_cmd + !!extcmd > 1) + die(_("--gui, --tool and --extcmd are mutually exclusive")); + if (use_gui_tool && diff_gui_tool && *diff_gui_tool) setenv("GIT_DIFF_TOOL", diff_gui_tool, 1); else if (difftool_cmd) { diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index bb9a7f4ff9..fd4a2a93b6 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -705,4 +705,12 @@ test_expect_success SYMLINKS 'difftool --dir-diff handles modified symlinks' ' test_cmp expect actual ' +test_expect_success 'difftool --gui, --tool and --extcmd are mutually exclusive' ' + difftool_test_setup && + test_must_fail git difftool --gui --tool=test-tool && + test_must_fail git difftool --gui --extcmd=cat && + test_must_fail git difftool --tool=test-tool --extcmd=cat && + test_must_fail git difftool --gui --tool=test-tool --extcmd=cat +' + test_done From patchwork Mon Apr 29 06:21:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 10921283 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 3A1C61515 for ; Mon, 29 Apr 2019 06:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28C45285E5 for ; Mon, 29 Apr 2019 06:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CF0328608; Mon, 29 Apr 2019 06:21:26 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 A3AE0285E5 for ; Mon, 29 Apr 2019 06:21:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727380AbfD2GVY (ORCPT ); Mon, 29 Apr 2019 02:21:24 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:39561 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbfD2GVY (ORCPT ); Mon, 29 Apr 2019 02:21:24 -0400 Received: by mail-it1-f193.google.com with SMTP id t200so1943856itf.4 for ; Sun, 28 Apr 2019 23:21:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iukTblG9BC3DzjM64TMQuw/otThZp2vhxk5xe/+N/5U=; b=vVo9UXivlMnCBUy1c6Q904lvDxTtRyDcble3TZWZ+KKdRD43ta/DEd2ejpN9XsY8Vt uG1bZHmvtMDH+swQFugXRMD9Mulala6rSPZMbL5gzydC0Eo9wS6Rzvlk/KHWiHs4Cnti XBqaNpgyWQULy2f1FW4kGFwuU86xWaWjKBf9qk1WMVuGp/R3NgrvqmtsFwYsRuECW8N9 AbYlfLND14WNy/r3CJGTlj4S2TzCqMQfsWMEkZlTiwhiSLioCwgyYRY6/tzklSWCH14P Ta64n0pVSKKnv55EGbzTUVDclzazunlPRkss80n2UMwpxF/C/Kb1Z2r0UKG3WX5dnZwr 3b6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iukTblG9BC3DzjM64TMQuw/otThZp2vhxk5xe/+N/5U=; b=Y40x9SWpkJ68Q9E/bv9F4iFZyZ53RdQ5OhRPVw/WgkTXJrZwXhvLf5E04bHy59bt/P 2dN0/cP++tPC5gV19vI90y7/lIMg+BI9sB2P21oUFKdVpCWehyf5Rx9ifuuQFz4jLI4T aRaFZBSmQgspnVNiUYzqsuscos5rl6reiZGdz0tCtHS9z6PzWkTpBMF/QTmV9ZHW4NBI H5vEYjyOic29yyaav/LmxhrZ90S++vOUlmQY9Xk6Bji0qz6aRQnigd9Mwz7sygQE7lyZ l/QBdqVxSZxA+ZwXAd8Ksk9YGQToDbuXZqzbokG2ha6BCveub0s/Hpu6SmMUEb2ZimPQ h4cQ== X-Gm-Message-State: APjAAAW4QFJFRflS4RzIGDx6imewe26s/2Hlkq9mgbjudCcPuhG3/h0t 9z4VvnyOal9//y5HAyb549utDIRO X-Google-Smtp-Source: APXvYqwrL3PvjnR59RF/tMYLA4/Hkhi0ymb52w9qTIbkVByy99wOVyBOOaZZKUMPWiAd6Pvhz+A9uA== X-Received: by 2002:a24:d941:: with SMTP id p62mr16644404itg.174.1556518883423; Sun, 28 Apr 2019 23:21:23 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.89.95]) by smtp.gmail.com with ESMTPSA id v7sm8142749iop.8.2019.04.28.23.21.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Apr 2019 23:21:22 -0700 (PDT) Date: Mon, 29 Apr 2019 02:21:20 -0400 From: Denton Liu To: Git Mailing List Cc: Johannes Schindelin , David Aguilar , Jeff Hostetler , Eric Sunshine , Junio C Hamano Subject: [PATCH v5 7/7] difftool: fallback on merge.guitool Message-ID: <3fd4f46a7cd8fce71b246a60825b04c69bc1b537.1556518203.git.liu.denton@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In git-difftool.txt, it says 'git difftool' falls back to 'git mergetool' config variables when the difftool equivalents have not been defined. However, when `diff.guitool` is missing, it doesn't fallback to anything. Make git-difftool fallback to `merge.guitool` when `diff.guitool` is missing. Signed-off-by: Denton Liu --- Documentation/git-difftool.txt | 4 +++- builtin/difftool.c | 10 ++-------- t/t7800-difftool.sh | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Documentation/git-difftool.txt b/Documentation/git-difftool.txt index 96c26e6aa8..484c485fd0 100644 --- a/Documentation/git-difftool.txt +++ b/Documentation/git-difftool.txt @@ -90,7 +90,9 @@ instead. `--no-symlinks` is the default on Windows. When 'git-difftool' is invoked with the `-g` or `--gui` option the default diff tool will be read from the configured `diff.guitool` variable instead of `diff.tool`. The `--no-gui` - option can be used to override this setting. + option can be used to override this setting. If `diff.guitool` + is not set, we will fallback in the order of `merge.guitool`, + `diff.tool`, `merge.tool` until a tool is found. --[no-]trust-exit-code:: 'git-difftool' invokes a diff tool individually on each file. diff --git a/builtin/difftool.c b/builtin/difftool.c index 65bba90338..10660639c0 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -24,7 +24,6 @@ #include "object-store.h" #include "dir.h" -static char *diff_gui_tool; static int trust_exit_code; static const char *const builtin_difftool_usage[] = { @@ -34,11 +33,6 @@ static const char *const builtin_difftool_usage[] = { static int difftool_config(const char *var, const char *value, void *cb) { - if (!strcmp(var, "diff.guitool")) { - diff_gui_tool = xstrdup(value); - return 0; - } - if (!strcmp(var, "difftool.trustexitcode")) { trust_exit_code = git_config_bool(var, value); return 0; @@ -734,8 +728,8 @@ int cmd_difftool(int argc, const char **argv, const char *prefix) if (use_gui_tool + !!difftool_cmd + !!extcmd > 1) die(_("--gui, --tool and --extcmd are mutually exclusive")); - if (use_gui_tool && diff_gui_tool && *diff_gui_tool) - setenv("GIT_DIFF_TOOL", diff_gui_tool, 1); + if (use_gui_tool) + setenv("GIT_MERGETOOL_GUI", "true", 1); else if (difftool_cmd) { if (*difftool_cmd) setenv("GIT_DIFF_TOOL", difftool_cmd, 1); diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh index fd4a2a93b6..957ddf5dc6 100755 --- a/t/t7800-difftool.sh +++ b/t/t7800-difftool.sh @@ -279,11 +279,27 @@ test_expect_success 'difftool + mergetool config variables' ' echo branch >expect && git difftool --no-prompt branch >actual && test_cmp expect actual && + git difftool --gui --no-prompt branch >actual && + test_cmp expect actual && # set merge.tool to something bogus, diff.tool to test-tool test_config merge.tool bogus-tool && test_config diff.tool test-tool && git difftool --no-prompt branch >actual && + test_cmp expect actual && + git difftool --gui --no-prompt branch >actual && + test_cmp expect actual && + + # set merge.tool, diff.tool to something bogus, merge.guitool to test-tool + test_config diff.tool bogus-tool && + test_config merge.guitool test-tool && + git difftool --gui --no-prompt branch >actual && + test_cmp expect actual && + + # set merge.tool, diff.tool, merge.guitool to something bogus, diff.guitool to test-tool + test_config merge.guitool bogus-tool && + test_config diff.guitool test-tool && + git difftool --gui --no-prompt branch >actual && test_cmp expect actual '