From patchwork Wed Aug 10 15:02:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12940634 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 1E302C25B07 for ; Wed, 10 Aug 2022 15:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232920AbiHJPCh (ORCPT ); Wed, 10 Aug 2022 11:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232657AbiHJPCf (ORCPT ); Wed, 10 Aug 2022 11:02:35 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA6B75FFA for ; Wed, 10 Aug 2022 08:02:34 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id l4so18026775wrm.13 for ; Wed, 10 Aug 2022 08:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=4gnUj/pP2WGXtTkhNLh91Vsayn8+83uN5fCWQI2ZtrY=; b=j4mIb9HJLC2G+r/nDzkIZn78gVy+5YSiFQz0DkAHMi3mbeuSld53Wm/4QllQRQ+Vg9 MJv5fsAV1J4b29BiFMWTP0orPaZNEILJWyWeyjyYaYUTLznl2OuK1iwp/1QDWUzxG0Vy msmV8McBBCXQWf9Q4WJcqZU3RjNHeIoFqVt8Bq2d8tmatlwxl5qLXfi16zrHtBN2JvUV TG7qxMOTRvJsvSSaUfGQu1/aBayhvNSYelyQOPl+1440WySJ4ZGO4mKMCU7RDNIt7kPN oSvc4pmsJZtyvbFa2IDeaxzQ8V/x5LJ7DqaLvME5zLdzbndxKYkdn3PRj4KO1CYGRi39 eMnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=4gnUj/pP2WGXtTkhNLh91Vsayn8+83uN5fCWQI2ZtrY=; b=i0fkyFmSLvkxziSMlYSRBHJzraQEMek6Fl++ImyQ/vIrSYT3F18pfVaIRV9eWcLQPf /a6BoKZrxTVo5WvBBPR2PU+PVu1Wwy41JxLrmYlD5z0wytIZ3k4RiKxKjRM7tTL1mtul KIW4EC1XEkrnn0hZnFOIHEcagd1ioWQyX9FzFLhjcHofttI22V1qdVfKQHTloG9D8IkH N70hUhtl2624sX51ZpwJV9HUJNnRsyvQzOevNHXBay1vDXnttGBumKhlZj7qcjkXUhOS byvpctCjJvv3JwoGbMXc4rMWNpSHDLMIC95WSyNRSwm4oom4S0YIZOQIrYqi1LI0IJ8T AyMg== X-Gm-Message-State: ACgBeo1/18RdyzcMPesy7SNVVr8DTvkALUuqmfEjhlqEVaZLb2w9Mu66 gBl/+cNpwXhKAwXHkWiAxunBmnh1+WU= X-Google-Smtp-Source: AA6agR7vCemB84OFoxM8oT6+nFjmfOivNqzoW/5lIX29z9wwL11KM2IYYpuWt+qmpR9yDAthq7uo0g== X-Received: by 2002:adf:e848:0:b0:220:7dc6:135f with SMTP id d8-20020adfe848000000b002207dc6135fmr17556270wrn.24.1660143752900; Wed, 10 Aug 2022 08:02:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m11-20020a7bcb8b000000b003a550be861bsm2607391wmi.27.2022.08.10.08.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:02:32 -0700 (PDT) Message-Id: <9cf14984c0a71b1ccdff7db0699571bf5af1209b.1660143750.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 10 Aug 2022 15:02:26 +0000 Subject: [PATCH 1/5] cmake: align CTest definition with Git's CI runs Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In Git's CI runs, the Windows tests are run with `--no-bin-wrappers` and `--no-chain-lint`, mainly to win back some time caused by the serious performance penalty paid for the tests relying so heavily on POSIX shell scripting, which only works by using a POSIX emulation layer. Let's do the same when running the tests, say, in Visual Studio. While at it, enable the command trace via `-x` and verbose output via `-v`, otherwise it would be near impossible to diagnose any problems. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 1b23f2440d8..4aee1e24342 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1088,7 +1088,7 @@ file(GLOB test_scipts "${CMAKE_SOURCE_DIR}/t/t[0-9]*.sh") #test foreach(tsh ${test_scipts}) add_test(NAME ${tsh} - COMMAND ${SH_EXE} ${tsh} + COMMAND ${SH_EXE} ${tsh} --no-bin-wrappers --no-chain-lint -vx WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/t) endforeach() From patchwork Wed Aug 10 15:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12940635 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 26FC7C00140 for ; Wed, 10 Aug 2022 15:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232926AbiHJPCj (ORCPT ); Wed, 10 Aug 2022 11:02:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232916AbiHJPCh (ORCPT ); Wed, 10 Aug 2022 11:02:37 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FC0475FE3 for ; Wed, 10 Aug 2022 08:02:36 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id j7so18101546wrh.3 for ; Wed, 10 Aug 2022 08:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=Q3KJWsUHoyvk83fYpnqq1nuFuvSaE5HztSbDUOVTRRs=; b=k0QpzvfrxYwGBMOxnBdx+sMafIUTr+Mds1jCOMmdZ8soXVfrog4MLFnIdIn0HdqixB 8WkDWf2cBKjIUN1JVkGi45MEfcGtUG3S9v0ALFR5xqZrfhdPFzTc3Wd+0xN4NUbMgpMY d9+rzO0GW4PTAr71a2x8ZeoHRI0awylkVS/nNRwpgzcdFoKJLRiCqA/EXdGxw6dcH798 p0VmzFJo3IxW2zk9zsjmn4xU0PDXY1QYU0SakxbXCJ3+1W1MH3dTt9s7hD98G/VPNMhi WS6EjyrrT+5GoM+f3F2Gqgt15kfXuWOfQzW7WL5wGFrqa7n2rg1UGocDI60F7EQacCHO 4Jkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=Q3KJWsUHoyvk83fYpnqq1nuFuvSaE5HztSbDUOVTRRs=; b=XpgtwfXTVWTicKUnUhGrLcL7oKv6GepUXo1QWRjTXC/D23nSb2nqrr4EFuR0jFwOTW SLpIy9ycxqtDeIJlrUeljjKKqqTl6g2L/T9GrTa5S5pmyFqTNcqNFxmkDN/ye1Ryr1Wk uOwObk1+dfh4npFLvGZ0gn3Vl9oxOL/Pe3+s5u6BxyvKi5Q3pOtEjYYWNe/X41ZyHzcF o+/mouSyvSpU117HA1hTnbcjKAVOcMlef5UcETnMPlF2ONxU0qC3Et0wA8KT8wGXs0lN v9bNdNwjbqNfCWT6zKw8gNSUv1H8tyZvfgqjtRFoy5WIKldibdGvXZbyDRJ0+mkfBcud eS4A== X-Gm-Message-State: ACgBeo2nWaMPzrig+6DxLKEcJZSr5+0hmNqZvL73sHEYnUIImftU0wTJ 0BPY8JpDn7h2g+C4A3koTWiJV5JrVWo= X-Google-Smtp-Source: AA6agR6ZGnzYy8YkoBKZ9rLqLgccezi2vVJ9jvTXRuHTHUh6NnBv1JkdDxRv6s75bSvNcVe587ZL+w== X-Received: by 2002:adf:f384:0:b0:21f:1522:6b1a with SMTP id m4-20020adff384000000b0021f15226b1amr18481188wro.593.1660143754234; Wed, 10 Aug 2022 08:02:34 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w8-20020a5d4b48000000b0021e4edba1e5sm16255058wrs.111.2022.08.10.08.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:02:33 -0700 (PDT) Message-Id: <86ab58b65081601678a24f99eb4afa34cccaefba.1660143750.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 10 Aug 2022 15:02:27 +0000 Subject: [PATCH 2/5] cmake: copy the merge tools for testing Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin Even when running the tests via CTest, t7609 and t7610 rely on more than only a few mergetools to be copied to the build directory. Let's make it so. Signed-off-by: Johannes Schindelin --- contrib/buildsystems/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 4aee1e24342..fe606c179f7 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1078,7 +1078,8 @@ if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) #misc copies file(COPY ${CMAKE_SOURCE_DIR}/t/chainlint.sed DESTINATION ${CMAKE_BINARY_DIR}/t/) file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/) - file(COPY ${CMAKE_SOURCE_DIR}/mergetools/tkdiff DESTINATION ${CMAKE_BINARY_DIR}/mergetools/) + file(GLOB mergetools "${CMAKE_SOURCE_DIR}/mergetools/*") + file(COPY ${mergetools} DESTINATION ${CMAKE_BINARY_DIR}/mergetools/) file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-prompt.sh DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) file(COPY ${CMAKE_SOURCE_DIR}/contrib/completion/git-completion.bash DESTINATION ${CMAKE_BINARY_DIR}/contrib/completion/) endif() From patchwork Wed Aug 10 15:02:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12940636 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 44B65C00140 for ; Wed, 10 Aug 2022 15:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232942AbiHJPCp (ORCPT ); Wed, 10 Aug 2022 11:02:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232923AbiHJPCi (ORCPT ); Wed, 10 Aug 2022 11:02:38 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3F24760C8 for ; Wed, 10 Aug 2022 08:02:37 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id az6-20020a05600c600600b003a530cebbe3so1139452wmb.0 for ; Wed, 10 Aug 2022 08:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=IiyAAazuRgzTBIhR7doOkSDf4ZWZUp/2zjSHTSbR9YA=; b=GFq2cKQF8mhJTAMvFzFc4qQZLNzIOzSICKu3Fq8SAB+fUi0Xy+OI2svcO6A5gzcEkP Hsm4HUvSglnwyDFQdJhALWbDBhfCWZ+KyCl4z7diHDtyPkzWzNYAdqlF5vMZ41PQ8M1x v6VVaHpZmA6z5miUZ+5ncNojKMrAfiCG+mUdOFNsgKr68SbUY0EIjRnj1mt9R6IwGmx/ n/uHd7pydZEz/O9VzeKDMgPwzPfMA3XpDv/fjrc3nZdvlzdgJpzCcLeLCZ6dTalPZYrf huh9Gh5hRATKItnw+Q/hjr1gw+EIs1+3lN9MFX9zVDAZyAuEZk9hHOfVebM/vf0R2JzI L+wQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=IiyAAazuRgzTBIhR7doOkSDf4ZWZUp/2zjSHTSbR9YA=; b=u5sR89L8O0yUi2aMVuiFmkwdX4NQi0APvvEUt/2yTJ/yfxIOivwFk8A2SRvOKEp6wT gWP/o9YiAEbf4RylFHFLd/yaCndanM4T6/ymJaADC4dKqjW6yNvYm2y/gQOrzIrqY6NI aiOKT8eo032jH+zGEyTMFNzKErFGkSyQvmFSAn+V0af+rg89LjqHftwHv+P+TRvZgF0u +pymvDTVa9bqqLtKHpBxxJQkj1tCNf573aqslAdkHRnFXSUzu7o78Cx56dxIx1hiZNev IFP2L1cQpX/M7iyZuGty1KMrOBFH9MHIz2S58Mp7a1wQppPu6Aq+az9QlSaRCbIukg1G 1HVQ== X-Gm-Message-State: ACgBeo0bNS1+8BMoLVrOnkbydEgnSUFb3Dec79j9XlEbz3RRoAc0PaUG OuissBF9pTsuCpZiZAW65PTVH4h+0To= X-Google-Smtp-Source: AA6agR6pcMVTbPzlHup0p9F2e08ztfvxQr+8KJwgGvZwve4Or5N64FRRcOxlUODXpgt0/sWlmJPROg== X-Received: by 2002:a1c:7518:0:b0:3a5:1681:b175 with SMTP id o24-20020a1c7518000000b003a51681b175mr2711160wmc.139.1660143755514; Wed, 10 Aug 2022 08:02:35 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 22-20020a05600c26d600b003a511e92abcsm2510852wmv.34.2022.08.10.08.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:02:34 -0700 (PDT) Message-Id: <79abfa82c32ea686469cfe2417bc491c04179623.1660143750.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 10 Aug 2022 15:02:28 +0000 Subject: [PATCH 3/5] tests: explicitly skip `chmod` calls on Windows Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin On Windows, we use a POSIX emulation layer, the MSYS2 runtime, to allow for running shell scripts (albeit at a hefty performance cost, Git's test suite takes ~700 seconds to complete on Linux, according to Git's CI runs, while it takes more than 6,000 seconds on Windows). This emulation layer has a funny quirk when it comes to `chmod` invocations: it pretends that it succeeded, when in reality it did not do a thing (because the Access Control Lists used in Windows' permission model are so different to Unix' default permission model that Git's test suite assumes to be in effect). Git's test suite relies on this quirk by assuming that the `chmod` calls in `test_chmod` and `test_write_script` simply succeed on Windows (without actually doing anything). However, this quirk is only in effect as long as `chmod` is run inside the pseudo Unix root directory structure or within the home directory. When run outside, such invocations fail like this: chmod: changing permissions of '': Invalid argument Now, when running Git's tests in, say, Visual Studio, we frequently are in a worktree where the `chmod` invocations would fail. Let's accommodate for that by explicitly skipping those `chmod` invocations on Windows. Signed-off-by: Johannes Schindelin --- t/test-lib-functions.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 6da7273f1d5..7c63b22acab 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -492,7 +492,10 @@ test_commit_bulk () { # of a file in the working directory and add it to the index. test_chmod () { - chmod "$@" && + if test_have_prereq !MINGW + then + chmod "$@" + fi && git update-index --add "--chmod=$@" } @@ -548,7 +551,10 @@ write_script () { echo "#!${2-"$SHELL_PATH"}" && cat } >"$1" && - chmod +x "$1" + if test_have_prereq !MINGW + then + chmod +x "$1" + fi } # Usage: test_hook [options] <<-\EOF From patchwork Wed Aug 10 15:02:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12940637 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 358CFC00140 for ; Wed, 10 Aug 2022 15:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232932AbiHJPCs (ORCPT ); Wed, 10 Aug 2022 11:02:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232916AbiHJPCk (ORCPT ); Wed, 10 Aug 2022 11:02:40 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70CD760CB for ; Wed, 10 Aug 2022 08:02:38 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id z17so18057723wrq.4 for ; Wed, 10 Aug 2022 08:02:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=TmBAYm4sYmaRuld1xeVh4ZPfnufQ3XTBy9onLsl+BK0=; b=Gq/7sCVvq9gyrdM6BUldGP+VWfOCB2wxY/dY/IUGgMAFG3tKXZn29EbvrBoXjSd05f 23tpnk0OMkJXdKmIIijVs69DzYFMMYnAXgVAmhJd9GV1jCSpVchiJqHfpFD/Z3+u2782 A2nEEXqhSl9ctRGaVZhzpYMEPSeNGIp6KSoVawKZa6bVvDa3/6U/xVIy4X2NE2dzrir6 3t/bNwmEwRhfHWZRskD496xSKPneK1ddTnxb3A9mRSsQL0osVswryYsh0u88zL7y59UZ 5sWBf4UdH3PUg+13exof6aJPyxCOyspOoRsrkyyaezoZbKsxABdDL2lwgpV21SlTZV9j Tt+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=TmBAYm4sYmaRuld1xeVh4ZPfnufQ3XTBy9onLsl+BK0=; b=1zoJjIkHHhk1YggnOCbLVM+28YPRGFNbn0kkrLnMhhogpahOTwLLOqAscJHOUK0SUT bGmBghigZaMDGiOreC6ixa/q5LnamypcQsCuE5S6Xb/mSkBwWfmnC0/kKXqvFAwc5hDx OBWBreuTNSozlyo2Bq9i1YgoXG5uwOH7IpOPHuSR8OieAht1TDut5+jXo49wwjCpfBTV PU6zDfAWp62sJg/4UEwmF1UlryQgzL+Kj4sgqovwPA+RYXiXtEa0xcfzuO+o57LyIWjf BpWd+PQO4SkPmYHdBx0iUPybx6bJAUTyiCi1/y1kTckymnVkOIFSFe1L6xX9ET5Nfdyt xpgA== X-Gm-Message-State: ACgBeo3mvBQPsYZ9/plHtjyGnE3R/Icwmxqtbytm5DWYfGGc+BOilXVp uOsnPWZrcmgp25muSwj5795PLIcRcHU= X-Google-Smtp-Source: AA6agR4t9xjlmep9/mBPcCRysl/M09SYtsNW6vlj3mUXSe5g3do3B0rlYi/4k2xW0hMvjjpDsne7eA== X-Received: by 2002:adf:f584:0:b0:222:cd33:fbbc with SMTP id f4-20020adff584000000b00222cd33fbbcmr9319640wro.624.1660143756758; Wed, 10 Aug 2022 08:02:36 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m8-20020a5d56c8000000b00222d4dfcdffsm6744562wrw.87.2022.08.10.08.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:02:35 -0700 (PDT) Message-Id: <4d24a4345ba66031d2ccf7ce472ed93ace82e9d6.1660143750.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Wed, 10 Aug 2022 15:02:29 +0000 Subject: [PATCH 4/5] add -p: avoid ambiguous signed/unsigned comparison Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In the interactive `add` operation, users can choose to jump to specific hunks, and Git will present the hunk list in that case. To avoid showing too many lines at once, only a maximum of 21 hunks are shown, skipping the "mode change" pseudo hunk. The comparison performed to skip the "mode change" pseudo hunk (if any) compares a signed integer `i` to the unsigned value `mode_change` (which can be 0 or 1 because it is a 1-bit type). According to section 6.3.1.8 of the C99 standard (see e.g. https://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf), what should happen is an automatic conversion of the "lesser" type to the "greater" type, but since the types differ in signedness, it is ill-defined what is the correct "usual arithmetic conversion". Which means that Visual C's behavior can (and does) differ from GCC's: When compiling Git using the latter, `add -p`'s `goto` command shows no hunks by default because it casts a negative start offset to a pretty large unsigned value, breaking the "goto hunk" test case in `t3701-add-interactive.sh`. Let's avoid that by converting the unsigned bit explicitly to a signed integer. Signed-off-by: Johannes Schindelin --- add-patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add-patch.c b/add-patch.c index 509ca04456b..3524555e2b0 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1547,7 +1547,7 @@ soft_increment: strbuf_remove(&s->answer, 0, 1); strbuf_trim(&s->answer); i = hunk_index - DISPLAY_HUNKS_LINES / 2; - if (i < file_diff->mode_change) + if (i < (int)file_diff->mode_change) i = file_diff->mode_change; while (s->answer.len == 0) { i = display_hunks(s, file_diff, i); From patchwork Wed Aug 10 15:02:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Schindelin X-Patchwork-Id: 12940638 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 50DE1C19F2A for ; Wed, 10 Aug 2022 15:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232953AbiHJPCu (ORCPT ); Wed, 10 Aug 2022 11:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232935AbiHJPCm (ORCPT ); Wed, 10 Aug 2022 11:02:42 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D36075FE5 for ; Wed, 10 Aug 2022 08:02:40 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id c187-20020a1c35c4000000b003a30d88fe8eso1155340wma.2 for ; Wed, 10 Aug 2022 08:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc; bh=oqn06qcCx888JqXrAWFrPw6Pt3QXV7A7ysDTY/54nAY=; b=b/WWvmRybyi2AvO/dt+frZExxtOq9zJAl5MbcJezVSluzpHF01D6Yj/Y5AcCnQ5v8y MZuCToOFzaE/0NdJM2s2uMbXE24+pqbOzdfX/PN4b85up6nRuRkK/oMwMNBGzkWvgfXo 6kOujjZsaa5/tKudIWAwRrUxqcB9iYfOBIeA4J55OmICQUvHz4S/6+896VC99XF8iNR4 PlV13iyvnyHxJ1io17LKfnCXS5UGJ8gNBQse2xspvFU/MJMSAcK3bxYSYe58fazK/n62 2QhhCfQPPpvqdaMd00FRllnzCfUoVIUDlReslC1mg1WlshDTAW2/HvZiRWJIfiAPeKME szDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc; bh=oqn06qcCx888JqXrAWFrPw6Pt3QXV7A7ysDTY/54nAY=; b=adsZ3jYRAVqJDYai/J/GhxdXENKV5VQkkxj+rz3FaDl+1+cmoofIqec3hbb7mjPGNE ivt7Hz3QVyv3V0TUj0op+pmtUTbDFXyqMG+DyuqenccAGpxK7WgUVXCDnjjoiI+AJ1Bl ehjWmdy6r/8a1L0s63+QKFiFJrwRCtK+X8UgdIw3DVh+DvtuMN/ZqKHURLcbgo+huNwf SIjGVU+mIJGWIGN4PZmWzYbgdROOL6m2m3cQzZ73nZG8mCphsCLlahOezTkf+kIC+sKG 99fgGFesrKwANQM/juPq8AJgrIDZBgE9puZwBsYcwm200wk3biHdSi416SYRDsI+AfrJ L79w== X-Gm-Message-State: ACgBeo2Ang+yai95Sy13GhDTYUKVIITHUEycvC2lv4HdkJmCQer2DjLg 1by1eYJNUqrnpoRCow1wLj9OMSvuzDo= X-Google-Smtp-Source: AA6agR4w1flu6HRxH3r4F6xBXQ2Lm7wOui5bPjMbhWTx6x5Ypm4o9MDcmD5iHRF/6EBdMA6JznDXfQ== X-Received: by 2002:a7b:ce10:0:b0:3a5:3f91:e2fb with SMTP id m16-20020a7bce10000000b003a53f91e2fbmr2855401wmc.138.1660143758149; Wed, 10 Aug 2022 08:02:38 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f14-20020a056000128e00b002217339ce90sm13976926wrx.8.2022.08.10.08.02.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 08:02:37 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Wed, 10 Aug 2022 15:02:30 +0000 Subject: [PATCH 5/5] cmake: avoid editing t/test-lib.sh Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Johannes Schindelin , Johannes Schindelin Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Johannes Schindelin From: Johannes Schindelin In 7f5397a07c6c (cmake: support for testing git when building out of the source tree, 2020-06-26), we implemented support for running Git's test scripts even after building Git in a different directory than the source directory. The way we did this was to edit the file `t/test-lib.sh` to override `GIT_BUILD_DIR` to point somewhere else than the parent of the `t/` directory. This is unideal because it always leaves a tracked file marked as modified, and it is all too easy to commit that change by mistake. Let's change the strategy by teaching `t/test-lib.sh` to detect the presence of a file called `GIT-BUILD-DIR` in the source directory. If it exists, the contents are interpreted as the location to the _actual_ build directory. We then write this file as part of the CTest definition. To support building Git via a regular `make` invocation after building it using CMake, we ensure that the `GIT-BUILD-DIR` file is deleted (for convenience, this is done as part of the Makefile rule that is already run with every `make` invocation to ensure that `GIT-BUILD-OPTIONS` is up to date). Signed-off-by: Johannes Schindelin --- .gitignore | 1 + Makefile | 1 + contrib/buildsystems/CMakeLists.txt | 7 +------ t/test-lib.sh | 11 ++++++++++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a4522157641..b72ddf09346 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /fuzz_corpora /fuzz-pack-headers /fuzz-pack-idx +/GIT-BUILD-DIR /GIT-BUILD-OPTIONS /GIT-CFLAGS /GIT-LDFLAGS diff --git a/Makefile b/Makefile index 04d0fd1fe60..9347ed90da7 100644 --- a/Makefile +++ b/Makefile @@ -3028,6 +3028,7 @@ else @echo RUNTIME_PREFIX=\'false\' >>$@+ endif @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi + @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi ### Detect Python interpreter path changes ifndef NO_PYTHON diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index fe606c179f7..29d7e236ae1 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1067,14 +1067,9 @@ endif() #Make the tests work when building out of the source tree get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE) if(NOT ${CMAKE_BINARY_DIR}/CMakeCache.txt STREQUAL ${CACHE_PATH}) - file(RELATIVE_PATH BUILD_DIR_RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/CMakeCache.txt) - string(REPLACE "/CMakeCache.txt" "" BUILD_DIR_RELATIVE ${BUILD_DIR_RELATIVE}) #Setting the build directory in test-lib.sh before running tests file(WRITE ${CMAKE_BINARY_DIR}/CTestCustom.cmake - "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh GIT_BUILD_DIR_REPL REGEX \"GIT_BUILD_DIR=(.*)\")\n" - "file(STRINGS ${CMAKE_SOURCE_DIR}/t/test-lib.sh content NEWLINE_CONSUME)\n" - "string(REPLACE \"\${GIT_BUILD_DIR_REPL}\" \"GIT_BUILD_DIR=\\\"$TEST_DIRECTORY/../${BUILD_DIR_RELATIVE}\\\"\" content \"\${content}\")\n" - "file(WRITE ${CMAKE_SOURCE_DIR}/t/test-lib.sh \${content})") + "file(WRITE ${CMAKE_SOURCE_DIR}/GIT-BUILD-DIR \"${CMAKE_BINARY_DIR}\")") #misc copies file(COPY ${CMAKE_SOURCE_DIR}/t/chainlint.sed DESTINATION ${CMAKE_BINARY_DIR}/t/) file(COPY ${CMAKE_SOURCE_DIR}/po/is.po DESTINATION ${CMAKE_BINARY_DIR}/po/) diff --git a/t/test-lib.sh b/t/test-lib.sh index 55857af601b..4468ac51f25 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -42,7 +42,16 @@ then TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY fi GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" -if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" +if test -f "$GIT_BUILD_DIR/GIT-BUILD-DIR" +then + GIT_BUILD_DIR="$(cat "$GIT_BUILD_DIR/GIT-BUILD-DIR")" || exit 1 + # On Windows, we must convert Windows paths lest they contain a colon + case "$(uname -s)" in + *MINGW*) + GIT_BUILD_DIR="$(cygpath -au "$GIT_BUILD_DIR")" + ;; + esac +elif test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2 exit 1