From patchwork Wed Oct 9 14:56:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828566 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E676F51C4A for ; Wed, 9 Oct 2024 14:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485775; cv=none; b=mBvNH43Qn6tzAafxaVhUrEfdqv5u+I2LIa0jJ/hSIsLMxNY+Dr9HdEBbzEy4wLOdAUR2Wadw1RlFrwvnM041kYO9P21RKQVMhQibJYMFIgK2ZETNxzA5nqreiP28+HxpxTQgq/0b5akANkStLt9WydQLrJcwL2C+F4VK9hPRYOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485775; c=relaxed/simple; bh=paSFZ05liBNpHKqAvhgdsyM2GqWzxE5voV3vahklk7Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZEd281+gwkNc80WLQz0Y1f9km5J6CgrrfzW6gpN2jkNfQYE681P0I5VxpOWAMFUMpVgUGqRHJAJRxxnosS9jCfaKT7VTCrbRCjrjdGUa4pOKL2x2FaJt96Dw5iCbh5Oni/Q6vbZFhCbdOzDHeLloS7cRE0nZp1pZH/q4sZN50sI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=AG2kZxvX; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=BPdOM1f6; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="AG2kZxvX"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="BPdOM1f6" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id E34F213802D7; Wed, 9 Oct 2024 10:56:12 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 09 Oct 2024 10:56:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485772; x=1728572172; bh=m2QGW9uE9Q RP9oajWG1llf+ZNnW+hp9n375a1EkXJw0=; b=AG2kZxvXPPOIXw5DpUvzuY+5l8 fqGUMJKz/bK9/VVd04cLaiebuIunWzpyt1EPnTgUrxfQ6SCqZt13AxhNS8JgZpga VvqLxmrQ6rNTa82VJcuIFzKWHGymwTCHXPRBNBhGIB6FweFs1sWxgcn6i6K/ZaQW u/XCi8/0XpclxZdnRHfxLll7tEw01ULl6cAIGp94DXvBiqAMgDUF7JqGTB1v2rKi cZlZ6n7T5Fdfj1jeSS5yyZOrINKwV/VsrdHrdb98VlCc7yreKdIORKvHuXqhCiwo XxRjbVinh+Q1a0wCsWGI1V2HryCsM+kcVZllHN8ryWcJonLPaUfckJe5xj0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485772; x=1728572172; bh=m2QGW9uE9QRP9oajWG1llf+ZNnW+ hp9n375a1EkXJw0=; b=BPdOM1f6sJ/A405RCep7pcT72GzFko0rsVXalm1lrJmY g7UVM2ItUuhruoyFmecw1mzwe0/ZmB4KkcP8x/vzEHyNWB3eKmyI+BVlw9XXCM68 aUALAEBEN1L1BBi1ug076dyj4BOx9EGZF1T3IdKPvBzawT8/UORUZxZek0dbI0fX nnFrhDZLW966X/tyUtsv7PmHIaNoOI/ZUJq1uZI2Bzm19B2Rf/DHkUWhqNAI2fEt NiD0EmTNoJzJ9OU+VNan8EkGnXn/1P9UBHxE/N3g9fkC9rnc+wF734Ucflur9KCN CPUYYbmlENNHPB5DnVrcg6SU7ydb35oSlfeTeqRIfQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepvghstghh figrrhhtiiesghgvnhhtohhordhorhhgpdhrtghpthhtohepphhhihhllhhiphdrfihooh guuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopehsuhhnshhhihhnvgesshhunhhs hhhinhgvtghordgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:11 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id fc26a518 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:08 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:09 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 01/24] t/test-lib: fix quoting of TEST_RESULTS_SAN_FILE Message-ID: <6dd59db9b2b0aed6a5156a7bb4098776b1d4cb88.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: When assembling our LSAN_OPTIONS that configure the leak sanitizer we end up prepending the string with various different colon-separated options via calls to `prepend_var`. One of the settings we add is the path where the sanitizer should store logs, which can be an arbitrary filesystem path. Naturally, filesystem paths may contain whitespace characters. And while it does seem as if we were quoting the value, we use escaped quotes and consequently split up the value if it does contain spaces. This leads to the following error in t0000 when having a value with whitespaces: .../t/test-lib.sh: eval: line 64: unexpected EOF while looking for matching `"' ++ return 1 error: last command exited with $?=1 not ok 5 - subtest: 3 passing tests The error itself is a bit puzzling at first. The basic problem is that the code sees the leading escaped quote during eval, but because we truncate everything after the space character it doesn't see the trailing escaped quote and thus fails to parse the string. Properly quote the value to fix the issue while using single-quotes to quote the inner value passed to eval. The issue can be reproduced by t0000 with such a path that contains spaces. Signed-off-by: Patrick Steinhardt --- t/test-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index b1a8ee5c002..241198ba95f 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1572,7 +1572,7 @@ then prepend_var LSAN_OPTIONS : dedup_token_length=9999 prepend_var LSAN_OPTIONS : log_exe_name=1 - prepend_var LSAN_OPTIONS : log_path=\"$TEST_RESULTS_SAN_FILE\" + prepend_var LSAN_OPTIONS : log_path="'$TEST_RESULTS_SAN_FILE'" export LSAN_OPTIONS elif test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" || From patchwork Wed Oct 9 14:56:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828568 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81C0419DF66 for ; Wed, 9 Oct 2024 14:56:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485779; cv=none; b=u+CS/1UUtTjBW+qAFXuwNJPVcptwoIVMxtDXugga8ImFC3foTQEZmjbgOrX9hcoQfMnjgf1nErzI1vqDQU1F6Q5JAlDBrwyjFUgXqVy9GuRtHSQpDHqd8ym15K5h27nPK0qlwQsd684w4n6ubugrckk/Nhn9e5dY8Ebe+gqBenk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485779; c=relaxed/simple; bh=9fHc4fP0nClmBO6aRuhVdGRjxIItcjY0SNct08k3MI8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=I1EAow8ZDiubtDTj7ykZiOKeTBV7JHMpS0CV3KIOCkTOV/boLbnrxNrfEfE5E2FQ7A/s2cFeeGMwnApTE0pbjX5XvmBT6ra+vN6VGK0bW3zM2ZIvmfSo3sVfdxAEeKhnMZ1/wY5QALDaCMrmC5k8P9Uu2e8WYoDG2/iSAy21ULs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=dJ/0lOrP; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=T4uOkSV4; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="dJ/0lOrP"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="T4uOkSV4" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.phl.internal (Postfix) with ESMTP id 87F571140147; Wed, 9 Oct 2024 10:56:15 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 09 Oct 2024 10:56:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1728485775; x=1728572175; bh=jNzz5IGO12qS56QxVVggmltTjQc3if+dNNa5UbBSD4U=; b= dJ/0lOrPepPcuNmOTSI3556dDvoIQ8397SMLtoV7hkZ2/3JyobkUfSCIlAseeQoV fikiDvOCpzXnb2ybk+RVYKB3JCyaEfzOOxjr8ZXqwFKyiIfGkgP1XhjHNYp2fmOA GQXR2rtBIrTmr9Jhn1wM8pruYN0uxP3A3zmBHEwMMaOqKKaz20u+o73wwHXadAUd hJ3GPEh1LmMl0B3pi/JVX5/M9cp/UPgZYLOuoQ1Kv1SP+9rq8bSJpbSS6FqlTcgL sgVCPFpQp/QPl/ll8e+DxDXG1SaDkkd3roN7dCKOVLV8FWKTgHibYg24D6Ds3ECZ y8OYpLp/a1U3qOKqxDUWow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728485775; x= 1728572175; bh=jNzz5IGO12qS56QxVVggmltTjQc3if+dNNa5UbBSD4U=; b=T 4uOkSV4824eDoVohCzyTZ3Xqak3VIm4z63mZNEcQRwlfMtPYujt5OpPGNOhpFWKj d/54NVjfBNeYgnMrQoyJDgcfsT4mKMGS2DNbBJWOpAOU7iPFM1T1HRWBBZH3jvb2 kVKL9ypIzM1r1qbof0oNqFr5HO4WmlS1rCT70X2OZqx9ZiscVlpVDLt0k9/kVCrQ 6MqegUYh/hKpJBL+6yO/eyHWhkBIQbeXv8kxYyQiJkVmg14DXOZpae1Z38coFXc1 Da8sZxlnmPkyL3884fz4A5aq6QFNANpp7xxmcuP1G9pSwUaCgAy9cdRUx5vzI9Lr t7sojvj5GKU5hxmkMZsug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdej necuhfhrohhmpefrrghtrhhitghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrih hmqeenucggtffrrghtthgvrhhnpeegiefhuefhkeetueeijeehheejveetveefvdfhleel hfeigeejtdfgtefhieeiteenucffohhmrghinhephhhtthhpqdhfvghttghhqdguuhhmsg drshhhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep phhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphht thhopehphhhilhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthhtoh epvghstghhfigrrhhtiiesghgvnhhtohhordhorhhgpdhrtghpthhtohepghhithhsthgv rhesphhosghogidrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrd horhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:14 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e6e45c1e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:10 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:12 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 02/24] t/test-lib: wire up NO_ICONV prerequisite Message-ID: <5ec91ac12dab4d89c636c03b4515584d0e544dfa.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The iconv library is used by Git to reencode files, commit messages and other things. As such it is a rather integral part, but given that many platforms nowadays use UTF-8 everywhere you can live without support for reencoding in many situations. It is thus optional to build Git with iconv, and some of our platforms wired up in "config.mak.uname" disable it. But while we support building without it, running our test suite with "NO_ICONV=Yes" causes many test failures. Wire up a new test prerequisite ICONV that gets populated via our GIT-BUILD-OPTIONS. Annotate failing tests accordingly. Note that this commit does not do a deep dive into every single test to assess whether the failure is expected or not. Most of the tests do smell like the expected kind of failure though. Further note that there are several "!MINGW" conditions in t4201, and all of these fail due to iconv-related errors. This is quite likely a leftover from times before dce7d29551 (msvc: support building Git using MS Visual C++, 2019-06-25), which switched Windows-based builds over from "NO_ICONV=YesPlease" to "NEEDS_LIBICONV=YesPlease". Consequently, adapt those tests to also use the new ICONV prerequisite. Signed-off-by: Patrick Steinhardt --- Makefile | 1 + contrib/buildsystems/CMakeLists.txt | 6 ++ t/t0028-working-tree-encoding.sh | 6 ++ t/t2082-parallel-checkout-attributes.sh | 2 +- t/t3434-rebase-i18n.sh | 6 ++ t/t3900-i18n-commit.sh | 6 ++ t/t3901-i18n-patch.sh | 6 ++ t/t4041-diff-submodule-option.sh | 16 ++- t/t4059-diff-submodule-not-initialized.sh | 16 ++- t/t4060-diff-submodule-option-diff-format.sh | 17 ++-- t/t4201-shortlog.sh | 8 +- t/t4205-log-pretty-formats.sh | 102 +++++++++++-------- t/t4210-log-i18n.sh | 6 ++ t/t4254-am-corrupt.sh | 6 ++ t/t5100-mailinfo.sh | 14 ++- t/t5550-http-fetch-dumb.sh | 4 +- t/t6006-rev-list-format.sh | 54 ++++++---- t/t7102-reset.sh | 40 +++++--- t/t8005-blame-i18n.sh | 6 ++ t/t9300-fast-import.sh | 2 +- t/t9350-fast-export.sh | 10 +- t/test-lib.sh | 1 + 22 files changed, 229 insertions(+), 106 deletions(-) diff --git a/Makefile b/Makefile index 2dde1fd2b8b..c094840426c 100644 --- a/Makefile +++ b/Makefile @@ -3172,6 +3172,7 @@ GIT-BUILD-OPTIONS: FORCE @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+ @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+ @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+ + @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+ @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+ @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+ @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+ diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 62af7b33d2f..1384c0eb6d3 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1109,6 +1109,7 @@ set(DIFF diff) set(PYTHON_PATH /usr/bin/python) set(TAR tar) set(NO_CURL ) +set(NO_ICONV ) set(NO_EXPAT ) set(USE_LIBPCRE2 ) set(NO_PERL ) @@ -1122,6 +1123,10 @@ if(NOT CURL_FOUND) set(NO_CURL 1) endif() +if(NOT Iconv_FOUND) + SET(NO_ICONV 1) +endif() + if(NOT EXPAT_FOUND) set(NO_EXPAT 1) endif() @@ -1145,6 +1150,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n") +file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") diff --git a/t/t0028-working-tree-encoding.sh b/t/t0028-working-tree-encoding.sh index ad151a34670..510da4ca12d 100755 --- a/t/t0028-working-tree-encoding.sh +++ b/t/t0028-working-tree-encoding.sh @@ -12,6 +12,12 @@ TEST_CREATE_REPO_NO_TEMPLATE=1 GIT_TRACE_WORKING_TREE_ENCODING=1 && export GIT_TRACE_WORKING_TREE_ENCODING +if ! test_have_prereq ICONV +then + skip_all='skipping working tree encoding tests; iconv not available' + test_done +fi + test_expect_success 'setup test files' ' git config core.eol lf && diff --git a/t/t2082-parallel-checkout-attributes.sh b/t/t2082-parallel-checkout-attributes.sh index aec55496eb1..a040aa54cee 100755 --- a/t/t2082-parallel-checkout-attributes.sh +++ b/t/t2082-parallel-checkout-attributes.sh @@ -34,7 +34,7 @@ test_expect_success 'parallel-checkout with ident' ' ) ' -test_expect_success 'parallel-checkout with re-encoding' ' +test_expect_success ICONV 'parallel-checkout with re-encoding' ' set_checkout_config 2 0 && git init encoding && ( diff --git a/t/t3434-rebase-i18n.sh b/t/t3434-rebase-i18n.sh index 26a48d6b103..97fc9a23f21 100755 --- a/t/t3434-rebase-i18n.sh +++ b/t/t3434-rebase-i18n.sh @@ -20,6 +20,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh +if ! test_have_prereq ICONV +then + skip_all='skipping rebase i18n tests; iconv not available' + test_done +fi + compare_msg () { iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect && git cat-file commit HEAD >raw && diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index db7b403bc15..9d4b5ab1f95 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -8,6 +8,12 @@ test_description='commit and log output encodings' TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh +if ! test_have_prereq ICONV +then + skip_all='skipping commit i18n tests; iconv not available' + test_done +fi + compare_with () { git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current && case "$3" in diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index 5f0b9afc3fa..e0659c92935 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -11,6 +11,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh +if ! test_have_prereq ICONV +then + skip_all='skipping patch i18n tests; iconv not available' + test_done +fi + check_encoding () { # Make sure characters are not corrupted cnt="$1" header="$2" i=1 j=0 diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh index 8fc40e75eb3..aa149e0085e 100755 --- a/t/t4041-diff-submodule-option.sh +++ b/t/t4041-diff-submodule-option.sh @@ -15,12 +15,18 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh -# Tested non-UTF-8 encoding -test_encoding="ISO8859-1" +# Test non-UTF-8 encoding in case iconv is available. +if test_have_prereq ICONV +then + test_encoding="ISO8859-1" + # String "added" in German (translated with Google Translate), encoded in UTF-8, + # used in sample commit log messages in add_file() function below. + added=$(printf "hinzugef\303\274gt") +else + test_encoding="UTF-8" + added="added" +fi -# String "added" in German (translated with Google Translate), encoded in UTF-8, -# used in sample commit log messages in add_file() function below. -added=$(printf "hinzugef\303\274gt") add_file () { ( cd "$1" && diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh index 668f5263038..28fd3cdb154 100755 --- a/t/t4059-diff-submodule-not-initialized.sh +++ b/t/t4059-diff-submodule-not-initialized.sh @@ -12,12 +12,18 @@ initialized previously but the checkout has since been removed. TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh -# Tested non-UTF-8 encoding -test_encoding="ISO8859-1" -# String "added" in German (translated with Google Translate), encoded in UTF-8, -# used in sample commit log messages in add_file() function below. -added=$(printf "hinzugef\303\274gt") +# Test non-UTF-8 encoding in case iconv is available. +if test_have_prereq ICONV +then + test_encoding="ISO8859-1" + # String "added" in German (translated with Google Translate), encoded in UTF-8, + # used in sample commit log messages in add_file() function below. + added=$(printf "hinzugef\303\274gt") +else + test_encoding="UTF-8" + added="added" +fi add_file () { ( diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh index 8ce67442d96..918334fa4c8 100755 --- a/t/t4060-diff-submodule-option-diff-format.sh +++ b/t/t4060-diff-submodule-option-diff-format.sh @@ -13,12 +13,17 @@ This test tries to verify the sanity of --submodule=diff option of git diff. TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh -# Tested non-UTF-8 encoding -test_encoding="ISO8859-1" - -# String "added" in German (translated with Google Translate), encoded in UTF-8, -# used in sample commit log messages in add_file() function below. -added=$(printf "hinzugef\303\274gt") +# Test non-UTF-8 encoding in case iconv is available. +if test_have_prereq ICONV +then + test_encoding="ISO8859-1" + # String "added" in German (translated with Google Translate), encoded in UTF-8, + # used in sample commit log messages in add_file() function below. + added=$(printf "hinzugef\303\274gt") +else + test_encoding="UTF-8" + added="added" +fi add_file () { ( diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh index c20c8857244..680e707ba1e 100755 --- a/t/t4201-shortlog.sh +++ b/t/t4201-shortlog.sh @@ -105,7 +105,7 @@ test_expect_success 'output from user-defined format is re-wrapped' ' test_cmp expect log.predictable ' -test_expect_success !MINGW 'shortlog wrapping' ' +test_expect_success ICONV 'shortlog wrapping' ' cat >expect <<\EOF && A U Thor (5): Test @@ -126,13 +126,13 @@ EOF test_cmp expect out ' -test_expect_success !MINGW 'shortlog from non-git directory' ' +test_expect_success ICONV 'shortlog from non-git directory' ' git log --no-expand-tabs HEAD >log && GIT_DIR=non-existing git shortlog -w out && test_cmp expect out ' -test_expect_success !MINGW 'shortlog can read --format=raw output' ' +test_expect_success ICONV 'shortlog can read --format=raw output' ' git log --format=raw HEAD >log && GIT_DIR=non-existing git shortlog -w out && test_cmp expect out @@ -182,7 +182,7 @@ $DSCHO (2): EOF -test_expect_success !MINGW 'shortlog encoding' ' +test_expect_success ICONV 'shortlog encoding' ' git reset --hard "$commit" && git config --unset i18n.commitencoding && echo 2 > a1 && diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh index eb63ce011fa..dbbd6125510 100755 --- a/t/t4205-log-pretty-formats.sh +++ b/t/t4205-log-pretty-formats.sh @@ -114,19 +114,19 @@ test_expect_success 'alias loop' ' test_must_fail git log --pretty=test-foo ' -test_expect_success 'NUL separation' ' +test_expect_success ICONV 'NUL separation' ' printf "add bar\0$(commit_msg)" >expected && git log -z --pretty="format:%s" >actual && test_cmp expected actual ' -test_expect_success 'NUL termination' ' +test_expect_success ICONV 'NUL termination' ' printf "add bar\0$(commit_msg)\0" >expected && git log -z --pretty="tformat:%s" >actual && test_cmp expected actual ' -test_expect_success 'NUL separation with --stat' ' +test_expect_success ICONV 'NUL separation with --stat' ' stat0_part=$(git diff --stat HEAD^ HEAD) && stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) && printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected && @@ -181,7 +181,7 @@ test_expect_success 'setup more commits' ' head4=$(git rev-parse --verify --short HEAD~3) ' -test_expect_success 'left alignment formatting' ' +test_expect_success ICONV 'left alignment formatting' ' git log --pretty="tformat:%<(40)%s" >actual && qz_to_tab_space <<-EOF >expected && message two Z @@ -192,7 +192,7 @@ test_expect_success 'left alignment formatting' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting. i18n.logOutputEncoding' ' +test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && message two Z @@ -203,7 +203,7 @@ test_expect_success 'left alignment formatting. i18n.logOutputEncoding' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting at the nth column' ' +test_expect_success ICONV 'left alignment formatting at the nth column' ' git log --pretty="tformat:%h %<|(40)%s" >actual && qz_to_tab_space <<-EOF >expected && $head1 message two Z @@ -214,7 +214,7 @@ test_expect_success 'left alignment formatting at the nth column' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting at the nth column' ' +test_expect_success ICONV 'left alignment formatting at the nth column' ' COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual && qz_to_tab_space <<-EOF >expected && $head1 message two Z @@ -225,7 +225,7 @@ test_expect_success 'left alignment formatting at the nth column' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' ' +test_expect_success ICONV 'left alignment formatting at the nth column. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && $head1 message two Z @@ -236,7 +236,7 @@ test_expect_success 'left alignment formatting at the nth column. i18n.logOutput test_cmp expected actual ' -test_expect_success 'left alignment formatting with no padding' ' +test_expect_success ICONV 'left alignment formatting with no padding' ' git log --pretty="tformat:%<(1)%s" >actual && cat <<-EOF >expected && message two @@ -258,7 +258,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn test_cmp expected actual ' -test_expect_success 'left alignment formatting with trunc' ' +test_expect_success ICONV 'left alignment formatting with trunc' ' git log --pretty="tformat:%<(10,trunc)%s" >actual && qz_to_tab_space <<-\EOF >expected && message .. @@ -269,7 +269,7 @@ test_expect_success 'left alignment formatting with trunc' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' ' +test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual && qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected && message .. @@ -280,7 +280,7 @@ test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncodin test_cmp expected actual ' -test_expect_success 'left alignment formatting with ltrunc' ' +test_expect_success ICONV 'left alignment formatting with ltrunc' ' git log --pretty="tformat:%<(10,ltrunc)%s" >actual && qz_to_tab_space <<-EOF >expected && ..sage two @@ -291,7 +291,7 @@ test_expect_success 'left alignment formatting with ltrunc' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' ' +test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && ..sage two @@ -302,7 +302,7 @@ test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncodi test_cmp expected actual ' -test_expect_success 'left alignment formatting with mtrunc' ' +test_expect_success ICONV 'left alignment formatting with mtrunc' ' git log --pretty="tformat:%<(10,mtrunc)%s" >actual && qz_to_tab_space <<-\EOF >expected && mess.. two @@ -313,7 +313,7 @@ test_expect_success 'left alignment formatting with mtrunc' ' test_cmp expected actual ' -test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' ' +test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual && qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected && mess.. two @@ -324,7 +324,7 @@ test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncodi test_cmp expected actual ' -test_expect_success 'right alignment formatting' ' +test_expect_success ICONV 'right alignment formatting' ' git log --pretty="tformat:%>(40)%s" >actual && qz_to_tab_space <<-EOF >expected && Z message two @@ -335,7 +335,7 @@ test_expect_success 'right alignment formatting' ' test_cmp expected actual ' -test_expect_success 'right alignment formatting. i18n.logOutputEncoding' ' +test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && Z message two @@ -346,7 +346,7 @@ test_expect_success 'right alignment formatting. i18n.logOutputEncoding' ' test_cmp expected actual ' -test_expect_success 'right alignment formatting at the nth column' ' +test_expect_success ICONV 'right alignment formatting at the nth column' ' git log --pretty="tformat:%h %>|(40)%s" >actual && qz_to_tab_space <<-EOF >expected && $head1 message two @@ -357,7 +357,7 @@ test_expect_success 'right alignment formatting at the nth column' ' test_cmp expected actual ' -test_expect_success 'right alignment formatting at the nth column' ' +test_expect_success ICONV 'right alignment formatting at the nth column' ' COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual && qz_to_tab_space <<-EOF >expected && $head1 message two @@ -368,7 +368,7 @@ test_expect_success 'right alignment formatting at the nth column' ' test_cmp expected actual ' -test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' ' +test_expect_success ICONV 'right alignment formatting at the nth column. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && $head1 message two @@ -381,7 +381,7 @@ test_expect_success 'right alignment formatting at the nth column. i18n.logOutpu # Note: Space between 'message' and 'two' should be in the same column # as in previous test. -test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' ' +test_expect_success ICONV 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual && iconv -f utf-8 -t $test_encoding >expected <<-EOF && * $head1 message two @@ -392,7 +392,7 @@ test_expect_success 'right alignment formatting at the nth column with --graph. test_cmp expected actual ' -test_expect_success 'right alignment formatting with no padding' ' +test_expect_success ICONV 'right alignment formatting with no padding' ' git log --pretty="tformat:%>(1)%s" >actual && cat <<-EOF >expected && message two @@ -403,7 +403,7 @@ test_expect_success 'right alignment formatting with no padding' ' test_cmp expected actual ' -test_expect_success 'right alignment formatting with no padding and with --graph' ' +test_expect_success ICONV 'right alignment formatting with no padding and with --graph' ' git log --graph --pretty="tformat:%>(1)%s" >actual && cat <<-EOF >expected && * message two @@ -414,7 +414,7 @@ test_expect_success 'right alignment formatting with no padding and with --graph test_cmp expected actual ' -test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' ' +test_expect_success ICONV 'right alignment formatting with no padding. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual && cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected && message two @@ -425,7 +425,7 @@ test_expect_success 'right alignment formatting with no padding. i18n.logOutputE test_cmp expected actual ' -test_expect_success 'center alignment formatting' ' +test_expect_success ICONV 'center alignment formatting' ' git log --pretty="tformat:%><(40)%s" >actual && qz_to_tab_space <<-EOF >expected && Z message two Z @@ -436,7 +436,7 @@ test_expect_success 'center alignment formatting' ' test_cmp expected actual ' -test_expect_success 'center alignment formatting. i18n.logOutputEncoding' ' +test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && Z message two Z @@ -446,7 +446,7 @@ test_expect_success 'center alignment formatting. i18n.logOutputEncoding' ' EOF test_cmp expected actual ' -test_expect_success 'center alignment formatting at the nth column' ' +test_expect_success ICONV 'center alignment formatting at the nth column' ' git log --pretty="tformat:%h %><|(40)%s" >actual && qz_to_tab_space <<-EOF >expected && $head1 message two Z @@ -457,7 +457,7 @@ test_expect_success 'center alignment formatting at the nth column' ' test_cmp expected actual ' -test_expect_success 'center alignment formatting at the nth column' ' +test_expect_success ICONV 'center alignment formatting at the nth column' ' COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual && qz_to_tab_space <<-EOF >expected && $head1 message two Z @@ -468,7 +468,7 @@ test_expect_success 'center alignment formatting at the nth column' ' test_cmp expected actual ' -test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' ' +test_expect_success ICONV 'center alignment formatting at the nth column. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual && qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected && $head1 message two Z @@ -479,7 +479,7 @@ test_expect_success 'center alignment formatting at the nth column. i18n.logOutp test_cmp expected actual ' -test_expect_success 'center alignment formatting with no padding' ' +test_expect_success ICONV 'center alignment formatting with no padding' ' git log --pretty="tformat:%><(1)%s" >actual && cat <<-EOF >expected && message two @@ -493,7 +493,7 @@ test_expect_success 'center alignment formatting with no padding' ' # save HEAD's SHA-1 digest (with no abbreviations) to use it below # as far as the next test amends HEAD old_head1=$(git rev-parse --verify HEAD~0) -test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' ' +test_expect_success ICONV 'center alignment formatting with no padding. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual && cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected && message two @@ -504,7 +504,7 @@ test_expect_success 'center alignment formatting with no padding. i18n.logOutput test_cmp expected actual ' -test_expect_success 'left/right alignment formatting with stealing' ' +test_expect_success ICONV 'left/right alignment formatting with stealing' ' git commit --amend -m short --author "long long long " && git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual && cat <<-\EOF >expected && @@ -515,7 +515,7 @@ test_expect_success 'left/right alignment formatting with stealing' ' EOF test_cmp expected actual ' -test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' ' +test_expect_success ICONV 'left/right alignment formatting with stealing. i18n.logOutputEncoding' ' git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual && cat <<-\EOF | iconv -f utf-8 -t $test_encoding >expected && short long long long @@ -564,22 +564,38 @@ test_expect_success 'log decoration properly follows tag chain' ' git tag -d tag1 && git commit --amend -m shorter && git log --no-walk --tags --pretty="%H %d" --decorate=full >actual && - cat <<-EOF >expected && - $head2 (tag: refs/tags/message-one) - $old_head1 (tag: refs/tags/message-two) - $head1 (tag: refs/tags/tag2) - EOF + if test_have_prereq ICONV + then + cat <<-EOF >expected + $head2 (tag: refs/tags/message-one) + $old_head1 (tag: refs/tags/message-two) + $head1 (tag: refs/tags/tag2) + EOF + else + cat <<-EOF >expected + $head2 (tag: refs/tags/message-one) + $old_head1 (tag: refs/tags/tag2, tag: refs/tags/message-two) + EOF + fi && sort -k3 actual >actual1 && test_cmp expected actual1 ' test_expect_success 'clean log decoration' ' git log --no-walk --tags --pretty="%H %D" --decorate=full >actual && - cat >expected <<-EOF && - $head2 tag: refs/tags/message-one - $old_head1 tag: refs/tags/message-two - $head1 tag: refs/tags/tag2 - EOF + if test_have_prereq ICONV + then + cat <<-EOF >expected + $head2 tag: refs/tags/message-one + $old_head1 tag: refs/tags/message-two + $head1 tag: refs/tags/tag2 + EOF + else + cat <<-EOF >expected + $head2 tag: refs/tags/message-one + $old_head1 tag: refs/tags/tag2, tag: refs/tags/message-two + EOF + fi && sort -k3 actual >actual1 && test_cmp expected actual1 ' diff --git a/t/t4210-log-i18n.sh b/t/t4210-log-i18n.sh index 7120030b5c6..4a12b2b4979 100755 --- a/t/t4210-log-i18n.sh +++ b/t/t4210-log-i18n.sh @@ -5,6 +5,12 @@ test_description='test log with i18n features' TEST_PASSES_SANITIZE_LEAK=true . ./lib-gettext.sh +if ! test_have_prereq ICONV +then + skip_all='skipping log i18n tests; iconv not available' + test_done +fi + # two forms of é utf8_e=$(printf '\303\251') latin1_e=$(printf '\351') diff --git a/t/t4254-am-corrupt.sh b/t/t4254-am-corrupt.sh index 661feb60709..cb03522d021 100755 --- a/t/t4254-am-corrupt.sh +++ b/t/t4254-am-corrupt.sh @@ -5,6 +5,12 @@ test_description='git am with corrupt input' TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh +if ! test_have_prereq ICONV +then + skip_all='skipping am encoding corruption tests; iconv not available' + test_done +fi + make_mbox_with_nul () { space=' ' q_nul_in_subject= diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index 065156c1f39..23b2f218725 100755 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@ -28,7 +28,12 @@ check_mailinfo () { for mail in 00* do - test_expect_success "mailinfo $mail" ' + case "$mail" in + 0004) + prereq=ICONV;; + esac + + test_expect_success $prereq "mailinfo $mail" ' check_mailinfo "$mail" "" && if test -f "$DATA/msg$mail--scissors" then @@ -56,7 +61,12 @@ test_expect_success 'split box with rfc2047 samples' \ for mail in rfc2047/00* do - test_expect_success "mailinfo $mail" ' + case "$mail" in + rfc2047/0001) + prereq=ICONV;; + esac + + test_expect_success $prereq "mailinfo $mail" ' git mailinfo -u "$mail-msg" "$mail-patch" <"$mail" >"$mail-info" && echo msg && test_cmp "$DATA/empty" "$mail-msg" && diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh index 58189c9f7dc..3c873de17ec 100755 --- a/t/t5550-http-fetch-dumb.sh +++ b/t/t5550-http-fetch-dumb.sh @@ -344,12 +344,12 @@ test_expect_success 'git client shows text/plain with a charset' ' grep "this is the error message" stderr ' -test_expect_success 'http error messages are reencoded' ' +test_expect_success ICONV 'http error messages are reencoded' ' test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr && grep "this is the error message" stderr ' -test_expect_success 'reencoding is robust to whitespace oddities' ' +test_expect_success ICONV 'reencoding is robust to whitespace oddities' ' test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr && grep "this is the error message" stderr ' diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index f1623b1c06d..2a01a62a2f3 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -13,21 +13,41 @@ TEST_PASSES_SANITIZE_LEAK=true . "$TEST_DIRECTORY"/lib-terminal.sh test_tick -# Tested non-UTF-8 encoding -test_encoding="ISO8859-1" - -# String "added" in German -# (translated with Google Translate), -# encoded in UTF-8, used as a commit log message below. -added_utf8_part=$(printf "\303\274") -added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding) -added=$(printf "added (hinzugef${added_utf8_part}gt) foo") -added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding) -# same but "changed" -changed_utf8_part=$(printf "\303\244") -changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding) -changed=$(printf "changed (ge${changed_utf8_part}ndert) foo") -changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding) + +if test_have_prereq ICONV +then + # Tested non-UTF-8 encoding + test_encoding="ISO8859-1" + + # String "added" in German + # (translated with Google Translate), + # encoded in UTF-8, used as a commit log message below. + added_utf8_part=$(printf "\303\274") + added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding) + added=$(printf "added (hinzugef${added_utf8_part}gt) foo") + added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding) + # same but "changed" + changed_utf8_part=$(printf "\303\244") + changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding) + changed=$(printf "changed (ge${changed_utf8_part}ndert) foo") + changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding) +else + # Tested non-UTF-8 encoding + test_encoding="UTF-8" + + # String "added" in German + # (translated with Google Translate), + # encoded in UTF-8, used as a commit log message below. + added_utf8_part="u" + added_utf8_part_iso88591="u" + added=$(printf "added (hinzugef${added_utf8_part}gt) foo") + added_iso88591="$added" + # same but "changed" + changed_utf8_part="a" + changed_utf8_part_iso88591="a" + changed=$(printf "changed (ge${changed_utf8_part}ndert) foo") + changed_iso88591="$changed" +fi # Count of char to truncate # Number is chosen so, that non-ACSII characters @@ -198,7 +218,7 @@ Thu, 7 Apr 2005 15:13:13 -0700 1112911993 EOF -test_format encoding %e <input <<-INPUT_END && commit refs/heads/encoding diff --git a/t/t9350-fast-export.sh b/t/t9350-fast-export.sh index 1eb035ee4ce..aa33791b77b 100755 --- a/t/t9350-fast-export.sh +++ b/t/t9350-fast-export.sh @@ -124,7 +124,7 @@ test_expect_success 'fast-export --show-original-ids | git fast-import' ' test $MUSS = $(git rev-parse --verify refs/tags/muss) ' -test_expect_success 'reencoding iso-8859-7' ' +test_expect_success ICONV 'reencoding iso-8859-7' ' test_when_finished "git reset --hard HEAD~1" && test_config i18n.commitencoding iso-8859-7 && @@ -420,7 +420,7 @@ M 100644 :1 there EOF -test_expect_success 'dropping tag of filtered out object' ' +test_expect_success ICONV 'dropping tag of filtered out object' ' ( cd limit-by-paths && git fast-export --tag-of-filtered-object=drop mytag -- there > output && @@ -437,7 +437,7 @@ msg EOF -test_expect_success 'rewriting tag of filtered out object' ' +test_expect_success ICONV 'rewriting tag of filtered out object' ' ( cd limit-by-paths && git fast-export --tag-of-filtered-object=rewrite mytag -- there > output && @@ -666,7 +666,7 @@ M 100644 :13 file EOF -test_expect_success 'avoid uninteresting refs' ' +test_expect_success ICONV 'avoid uninteresting refs' ' > tmp-marks && git fast-export --import-marks=tmp-marks \ --export-marks=tmp-marks main > /dev/null && @@ -685,7 +685,7 @@ from :14 EOF -test_expect_success 'refs are updated even if no commits need to be exported' ' +test_expect_success ICONV 'refs are updated even if no commits need to be exported' ' > tmp-marks && git fast-export --import-marks=tmp-marks \ --export-marks=tmp-marks main > /dev/null && diff --git a/t/test-lib.sh b/t/test-lib.sh index 241198ba95f..a278181a056 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1743,6 +1743,7 @@ esac ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1 test -z "$NO_CURL" && test_set_prereq LIBCURL +test -z "$NO_ICONV" && test_set_prereq ICONV test -z "$NO_PERL" && test_set_prereq PERL test -z "$NO_PTHREADS" && test_set_prereq PTHREADS test -z "$NO_PYTHON" && test_set_prereq PYTHON From patchwork Wed Oct 9 14:56:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828569 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D326B1A0BD8 for ; Wed, 9 Oct 2024 14:56:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485780; cv=none; b=E6bFhLdPN7p8dOgqQ5es7uWOR1pKdANiqF6thCiOzuVMut1aX3xQqOzoXY7RA2PCSxxxH/0JHI3t3ACSrCcwT+BqYmCRHkJXZKzYT36qwVL39dPz2X16HKEGrBhU8/nYbtZlLwizfwwb9C1kzjqgpmJFSXUsvtkzWRknGPZr1Jc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485780; c=relaxed/simple; bh=aInkWAtxQAUDeI8nwnkEFdOar1euJmQOcvGpr/l+pfQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZliofvCzwEUm1vU+SgEyfLiYWsW+LJ0H+ToF5LNXMewVDcE4Hsv1sKw2Ta4b5gLub80wk1cYwGRAwn+JozEHOE6TscnYDOBJqX0x+myLw06eBbinJRNIVzdOoItsf6ZFEWNu/JSfyNB4sPEDc4pqJ3f5kObyt5HJkoN4a6qnLN8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=pALpf9Nx; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=XebyEhZ9; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="pALpf9Nx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="XebyEhZ9" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id F39F8114013E; Wed, 9 Oct 2024 10:56:17 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 09 Oct 2024 10:56:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485777; x=1728572177; bh=FVP0Qo1RoI s3a407OD7rhr8oZQ/QXTBPpm9S1hNhAjI=; b=pALpf9NxZHs9y1uhDXCW6ISmP8 I2tlT5xKleRgQwhypNGGNrVm1HeDGdmyQLjk54cmg9hhJKitgsDu8xoxvTEAAYmo YqB6LGTPpXXC/PHp1ZUmPs3f0awUnxsQ9d3yLKCLhqBh25bZeD0Cr0VueLsgCXol mI97bxY6Rd/XX4nTn/4HJ/kgi/B4jnDxK252BAt77O6KS9IC17q2TY/wWUOI6cmH WNJVXLLpZihgntr0yRBXrmL5aHIQhUD2WWyGDR8Mc61w/o32iyIEQFSpmgsuTyom WCFsTzdi67Cf2xMCI6y58kXzzlggTAbpbsE9glTpYCOq2AhL3OcqyhfJPtWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485777; x=1728572177; bh=FVP0Qo1RoIs3a407OD7rhr8oZQ/Q XTBPpm9S1hNhAjI=; b=XebyEhZ9vAszpAa8j61cYE42XNhdlD4ZqQ0V3g00U8F6 2RlZolXFQTatG7XGu+KoLRsNpNc1Q012NVhtOPATN51Kst03FIyljslVqGYzRA5t HCPD1jRtK67wOvarPXmZx81j3z72Mj7x/gZ2DQQ+QcVo44kGC40/o4bpQ4koxLdZ eVJYjApO2KDZfJ1SPBt2eOkKmYNF+kD/SqxdXtOxvwTShK3G0XFF9BmnAk3E/S1a 3OX746zY2NHVMlkHtjB63Q10GY/itfDbNogYdHHhS6xNL7D8uqDv7BBgR7qIvcwK SRCbpcAwd1FZ1LbJi45glftJcfrSyWQ3eRPACwKoJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepshhunhhs hhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphhtthhopehphhhilhhlihhprd ifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthhtohepvghstghhfigrrhhtiies ghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:16 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 4244b129 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:13 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:14 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 03/24] t/lib-gitweb: test against the build version of gitweb Message-ID: <94664e2cc0681856635e13e1e4d5873a5a442d33.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: When testing gitweb we set up the CGI script as "gitweb.perl", which is the source file of the build target "gitweb.cgi". This works alright as long as we run in-tree tests. But we're about to make out-of-tree tests a reality, and there things will break because "gitweb.perl" will not be found in the build directory. Fix this by using "gitweb.cgi" instead. Signed-off-by: Patrick Steinhardt --- t/lib-gitweb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib-gitweb.sh b/t/lib-gitweb.sh index 1f32ca66ea5..c64c87fb87d 100644 --- a/t/lib-gitweb.sh +++ b/t/lib-gitweb.sh @@ -49,7 +49,7 @@ EOF error "Cannot find gitweb at $GITWEB_TEST_INSTALLED." say "# Testing $SCRIPT_NAME" else # normal case, use source version of gitweb - SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.perl" + SCRIPT_NAME="$GIT_BUILD_DIR/gitweb/gitweb.cgi" fi export SCRIPT_NAME } From patchwork Wed Oct 9 14:56:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828570 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6A29319F113 for ; Wed, 9 Oct 2024 14:56:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485783; cv=none; b=uWlw6wJYv+Fa3AnDkr4ln2FyOWyYLidicOXVEwovWy/cYfgXZJg33LHvSLhMBbP7cXBAK9lpDb84GiSTyR8ocSqNhyr/y45jNQR8G1cOywI0asGr6kS+54OQflh83KF+NHhIyBCyox8T1y7N0/KyTajZ8y97bJHBzBBd6sSwmVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485783; c=relaxed/simple; bh=sz8+FJfbDJEmYGlSsULuVY4b5/VYRLAVtiLICeNnSbQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r0LQ1Ik3t46z15mmYqg8uByJu+xTHuGoC/EdV6tM4LqGfAeGytdxd7SygMRrmTXmXPWsYi/zs+3lHAzv6ks166W/X1SvnS3SOpUukuM+m3JFFLR9QLRU+whQv7gjryMiy4mp8IY94u/YLOqHgLNZAJDxLH2pLApsS8qAPx03ZEQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=L9PFqjIF; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Dn55+29j; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="L9PFqjIF"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Dn55+29j" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id 8911313801AA; Wed, 9 Oct 2024 10:56:20 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 09 Oct 2024 10:56:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485780; x=1728572180; bh=XbpwAVxM/1 jpu5o6notWdip+cxP/ESw0hvmoxD/VpLQ=; b=L9PFqjIFsXiJyXTmbt02CCOBG4 S4icda0y4yWvdK5NtFCUw9v4H05kZNZdZf82Ws6bOCAi9LOUULSabeeITD6sjCjx CVOJJewhkSfxmRWMBL8GDXvl/qi4yrSlmrR3q5WGdUxi0H33KQB+yzAnxL1tFc1H Y1pM4hQEFAIJizAlbIrVwEmz7oSZSlMH+hbCqBgTJt3POn2dYevEYIX4wiAF88vI EQYifGpjhkDvfRmEbsZv5Y8QoZbcCDqTZweVY5yJdBpUPgIGwLjvOCSngxMLdSZV x3OO06AvArHMMFYeiw5qKH4da9T4QzSUdWcVhnUV/WHxncOTuFznaEZs7apw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485780; x=1728572180; bh=XbpwAVxM/1jpu5o6notWdip+cxP/ ESw0hvmoxD/VpLQ=; b=Dn55+29jPLyQwzmco7p71Q244pzFQP+v776vVbabYm/w lxnjpzBfIib/viWxZaTBYjzmm7REUMvCkIOF1ZDPQgL6ddj4taKl8Q2qVpbcsnBe 31CPuM/IJK0Ts9YlZ9/LY93ryZJ77HOBMMU3BgfHAZk12qIvMdfAu1rSlLAUiW23 zY2ZL+xqeNR16RBa95BMSD+7ol1o/7urQ6FvK0Qfdc6Xz02UIW4I8IE1zEsXoEpg VuXquvMvNMgB8Mwt2Zx+ZVe48ZKKmW4gAkgmhdpflJpjdydBpf5lIbdRF4o4rkmq /X/6EXBypiibIAr+9luLAsOMhylXuyuvTnuRe7kj3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopehsuhhnshhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthhtohep ghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegvshgthhifrghrth iisehgvghnthhoohdrohhrghdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdef sehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:19 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 3df3c697 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:16 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:17 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 04/24] t/lib-gpg: fix setup of GNUPGHOME in MinGW Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to point to a test-specific directory. This is done by using "$PWD/gpghome" as value, where "$PWD" is the current test's trash directory. This is broken for MinGW though because "$PWD" will use Windows-style paths that contain drive letters. What we really want in this context is a Unix-style path, which we can get by using `$(pwd)` instead. It is somewhat puzzling that nobody ever hit this issue, but it may easily be that nobody ever tests on Windows with GnuPG installed, which would make us skip those tests. Adapt the code accordingly to fix tests using this library. Signed-off-by: Patrick Steinhardt --- t/lib-gpg.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh index add11e88fc0..3845b6ac449 100644 --- a/t/lib-gpg.sh +++ b/t/lib-gpg.sh @@ -6,7 +6,7 @@ # executed in an eval'ed subshell that changes the working directory to a # temporary one. -GNUPGHOME="$PWD/gpghome" +GNUPGHOME="$(pwd)/gpghome" export GNUPGHOME test_lazy_prereq GPG ' From patchwork Wed Oct 9 14:56:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828571 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D56671A2625 for ; Wed, 9 Oct 2024 14:56:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485785; cv=none; b=dq68MLoTy34YrR6hC/LXiL23/GRQkNGisY3FPjgOpvQ3Tf7ik0cjDkmgy3nqcft33UTZKROcSouXChcQU0qTchU5Zev3AXW4xDpk35cRFpggRXa4SKd1vL9ntzzhaMLfxZy04pNXunfaUsLeKIl9J020vg4P5JtKFfXA/IMRu5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485785; c=relaxed/simple; bh=SUTkDErwh/2420QFyiqh7ViEIcXNKG28IQr40jcDmE4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sMuG/py30BLm0H5og7HMzZi6G4ZC4faYKHCuEde7K6vr98koHJeRoq3YaCwM0ac28AxQtgQBWGT+fRK4CYE1r+hTBGzGcUH8CiEIQJWyxC0v1RMymmKmqA6Fb3GlP2l8HRk0jotVujRrXyXm629XGDdOgRN3uDhR6bZUz9D05s4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=GWE5TkPZ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=AsGdQzbc; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="GWE5TkPZ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="AsGdQzbc" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id EF14513801C2; Wed, 9 Oct 2024 10:56:22 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 09 Oct 2024 10:56:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485782; x=1728572182; bh=Edrn/jY8KK Ig/SxNLl1HGOfkbyIXTVGJDW4/Di3p/28=; b=GWE5TkPZVXJjQyeZVA269aNYOw /SUJdqSKSnv2lLS+LmUUfwK/A6DBPQ0Src9JCP4JhnwIO49hzxGE509FmPNQJnnF kmD17Bk0FXt4YZEoshyDf6HUZhXEf+s1qcl4ZMZLNbEWou+ARRimSxM4WCtnHsH8 +3b4Txn0bPZaCw8UW+vHu4fjmIbNEtSpxREbWC+5GkT6bSvv0xSzLbpjOdsW1rsK 2UDd8TgsAJtYAhGc39t6wCyMfI1XK2bolGDGw7KX2NobdRI+wCXmdcgMqzk9A80C VaNToWsXnQZQjjz2j7PqMs8q2MU025lFx27WS8KgrVxzO44OB+tLByxID85A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485782; x=1728572182; bh=Edrn/jY8KKIg/SxNLl1HGOfkbyIX TVGJDW4/Di3p/28=; b=AsGdQzbcHTE0N+bcFGfoxzRIFmpplBnG/PWAbESfaQYH nZo84xQJWa5DYFRMtEZ0wAg4hV1YKyzjEe0UfGdMHOzgiodJX1qF3rNrubiJPDlS 7N67dkYj4ETcoKZ4N+bSZF/6kYEvpN2nptLIN+fv3m2ZJklmzvl7rmlwTagUQBJH lauK85tI3jwmo+0gmjnGgiJ42X8tmEfioYFvEKankE2f5Fx8R4Jgu0Z+k7lwLvSB ULE7euYtK5W2RdzsxaDAHTAxwuGi9GFe/m2sZyfmMVdz1ehS+nPEUG0MOIVLisZA WwWZ9SEEAxuX1+tpjUSV5xC+2GIwwUwsWBcCZ3Z9Ww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhgpd hrtghpthhtohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgt phhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhunh hshhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphhtthhopehgihhtshhtvghr sehpohgsohigrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:21 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 0dc47553 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:18 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:20 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 05/24] t1401: make invocation of tar(1) work with Win32-provided one Message-ID: <958cf3a6b578449eb26caeec6cb7ab9ce3fe66e2.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Windows nowadays provides a tar(1) binary in "C:\Windows\system32". This version of tar(1) doesn't seem to handle the case where directory paths end with a trailing forward slash. And as we do that in t1401 the result is that the test fails. Drop the trailing slash. Other tests that use tar(1) work alright, this is the only instance where it has been failing. --- t/t1401-symbolic-ref.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1401-symbolic-ref.sh b/t/t1401-symbolic-ref.sh index 5c60d6f812d..90af3f955c0 100755 --- a/t/t1401-symbolic-ref.sh +++ b/t/t1401-symbolic-ref.sh @@ -16,7 +16,7 @@ reset_to_sane() { test_expect_success 'setup' ' git symbolic-ref HEAD refs/heads/foo && test_commit file && - "$TAR" cf .git.tar .git/ + "$TAR" cf .git.tar .git ' test_expect_success 'symbolic-ref read/write roundtrip' ' From patchwork Wed Oct 9 14:56:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828572 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BE4D1A2647 for ; Wed, 9 Oct 2024 14:56:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485790; cv=none; b=CGdzBAdMJCTjzU6Wb0luOv6P0KDdo4bNuePUAYrq9wClCVeWd2XFJC9hHOF34fihk3rTtqTTJC7NBpb+99lARMskfCnYRmRp6woJfQrn0mB0B289CG9qT8MFYg+6MRz5iX5T0Zu+N7ARXT1nQkkzrOE8LkmIpI0iHbg4LNzm8mA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485790; c=relaxed/simple; bh=o3Y4WEpOf5cdm6Q2Kon9j36WNtSmqqXHdQ2Mm/m8gW0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t09Agt94c/jsKjoUeKPLkmS5ymJnHPZIRN/ZP0YnIXdWMjEtWhUEb8nEk0E9KCqwqDNtC/X9HMfO6pMR5Cs0RE67DwSqnjkJcR4x3ATALtra2t6+Lk8ABnoxSSKNM/vI1J5QzaV7beHDzbYsxkbL/WuV2VobpVd6AbtUSVUjh5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=EuSPFY+l; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=LKyKY9Nl; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="EuSPFY+l"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="LKyKY9Nl" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 90BBD13801BD; Wed, 9 Oct 2024 10:56:27 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 09 Oct 2024 10:56:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485787; x=1728572187; bh=8l9Vkk3ZmM s26mq7mQ/a/atpOUk0D1/v+dXlOkrBt9g=; b=EuSPFY+lZ0Qdg8pYgFf+kVBvLt 7BL89jGvNf2e/5VxKKxV+wbOd48RCLfRYCF8OXs90iXqgqAnwvHPUmAwN7d69+JT ZUiJ9NWSIRaqvmdN7j6k2Z2A9rmW/77C/xfgxNHqwKdNWFW8azmP+SKDXQbsGwlI WfUs3MbXgYuiIrfCplTJuULhX3wpsSACmrL5XMRJQERsdb8hPkBrgs9tlf5JgF10 tejMxlh22tLZtFyreKjQjGr6UsGWCiEd8k96iPhUDYtlGtjEQ4ltx8QDkX27FQlK +xgl9SJYj3LY90qHyqNRNLy5yO9yoivrtSCBF5Y7H7GRXNjnTCueSHhV0y2Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485787; x=1728572187; bh=8l9Vkk3ZmMs26mq7mQ/a/atpOUk0 D1/v+dXlOkrBt9g=; b=LKyKY9Nl9S1M/3Em3QR88dj6glBQiLbau+/2hn/BfzMB fOqhlQyi8KTmAQUphWQbciTCrjfFzeAT0myPh7trSoqMwLyOtkxy6bRGbyAEdsCe sQKpQ5ySqpHQ/+c2qWfyDuimJH23f6pJ1JZZX4hLVaGyHTlMZnxFt3BA3ZbpTdJi RYIOhBKEiPpCbsXTsn7JjQZ/OSJR0J/0rgof7Z0ff4YIoVnqDGGHn5oUBDiithGJ h4Yo/wJsmokm+YLpH0hq33/mUUGEu+vSySut01SzLrZd7rYx+XmXcCxQKE1lHsj7 ZG6CcAzJg6+GcW2crpXFw3LE1d8GiMHMHZGbeNyQoA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehsuhhnshhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthht ohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhope hgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepvghstghhfigrrhhtiies ghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:26 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 8dc5d4ad (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:23 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:22 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 06/24] t3404: work around platform-specific behaviour on macOS 10.15 Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Two of our tests in t3404 use indented HERE docs where leading tabs on some of the lines are actually relevant. The tabs do get removed though, and we try to fix this up by using sed(1) to replace leading tabs in the actual output, as well. But macOS 10.15 uses an oldish version of sed(1) that has BSD lineage, which does not understand "\t", and thus we fail to strip those leading tabs and fail the test. Address this issue by using `q_to_tab` such that we do not have to strip leading tabs from the actual output. Signed-off-by: Patrick Steinhardt --- t/t3404-rebase-interactive.sh | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index f171af3061d..7ce75237803 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -1917,18 +1917,17 @@ test_expect_success '--update-refs updates refs correctly' ' test_cmp_rev HEAD~1 refs/heads/third && test_cmp_rev HEAD refs/heads/no-conflict-branch && - cat >expect <<-\EOF && + q_to_tab >expect <<-\EOF && Successfully rebased and updated refs/heads/update-refs. Updated the following refs with --update-refs: - refs/heads/first - refs/heads/no-conflict-branch - refs/heads/second - refs/heads/third + Qrefs/heads/first + Qrefs/heads/no-conflict-branch + Qrefs/heads/second + Qrefs/heads/third EOF # Clear "Rebasing (X/Y)" progress lines and drop leading tabs. - sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \ - err.trimmed && + sed "s/Rebasing.*Successfully/Successfully/g" err.trimmed && test_cmp expect err.trimmed ' @@ -2178,19 +2177,18 @@ test_expect_success '--update-refs: check failed ref update' ' test_must_fail git rebase --continue 2>err && grep "update_ref failed for ref '\''refs/heads/second'\''" err && - cat >expect <<-\EOF && + q_to_tab >expect <<-\EOF && Updated the following refs with --update-refs: - refs/heads/first - refs/heads/no-conflict-branch - refs/heads/third + Qrefs/heads/first + Qrefs/heads/no-conflict-branch + Qrefs/heads/third Failed to update the following refs with --update-refs: - refs/heads/second + Qrefs/heads/second EOF # Clear "Rebasing (X/Y)" progress lines and drop leading tabs. tail -n 6 err >err.last && - sed -e "s/Rebasing.*Successfully/Successfully/g" -e "s/^\t//g" \ - err.trimmed && + sed "s/Rebasing.*Successfully/Successfully/g" err.trimmed && test_cmp expect err.trimmed ' From patchwork Wed Oct 9 14:56:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828573 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E29B91A2860 for ; Wed, 9 Oct 2024 14:56:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485793; cv=none; b=ZyHsPmKYhaolWjHLsOBJLGxtfDxvPUkU1ABfb5kr4O1ysm62Z3U2xWHPxPbzmmwfsUTqGu0eyWkAFc/WXe4TlwI6745Sn/bvh2BP8ZSZlb0mg9OT86Rop4+JpqhRD1xvZ6bRY/Ais/RsHAi5nDt72NjG4I7YjCMPjPSXBRGWPyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485793; c=relaxed/simple; bh=8kwz4IIKk2z8j7HxT1eLtoMLhbRaBsWQoa2hIiVxmKE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Rc0LT/6AMzRKHrIWbhQiR4wY/SynBowNPrCHXxvOEih4Xk1TJj4Qtsk5bAhlWu+k+T7DijnJ6thDh6QhlHFx/FREwbgZi5I0VAChZ5l02wWs/ygR2aLH8bRqRZP4W2v320mM4/cgquL7mlgHWMcKdYE2/dDAgwEZyIGYGWDW4pU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=sGNexgwH; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=RTIq420Z; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="sGNexgwH"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="RTIq420Z" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 0F94F13801C2; Wed, 9 Oct 2024 10:56:31 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 09 Oct 2024 10:56:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485791; x=1728572191; bh=EYVWAzTgIw 8ifUwtibrD/7HUy9NffIUnoQswPsRlVFg=; b=sGNexgwH5Y0nWbAYG3Xs+YCbzf 2scwNnsgo7f+Pc8pTwJbBbkfzdreFKvQUp6CkKaB4XWAEYddcz9eaal//tFiM9/9 iOgoYGYh8wjP9vAcuRoZXZkj0koZEURIVmgpTqLCbOR4HfKknHXUUYMmTfgclhja 8OMVtWUHR2bw1I1h6E0GzNWgbQUzn57QEIuH49ZQlb+f7tx/O4Dgtfa/vffVOAiY 0iyKl1RCrSrEkvDI2kdIrg5Yc9WY9T3z/SEm/udbSne3yKi4uJ3uRzpspyG6Lq8a PEdger5jSLvYNxv8XEeWsRi8b+MtY7N7XpyOnhMem813plYI/EVUtSyZLfpA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485791; x=1728572191; bh=EYVWAzTgIw8ifUwtibrD/7HUy9Nf fIUnoQswPsRlVFg=; b=RTIq420ZzKayrOEYTudlWOoQNumANN4XFpjoWso3ROfS +j4Xnkkd0dYnpgsklMEu/1xzmQ5ofnGqk9suV6URugPnro+5KBOfNMEevyNh2Xmo Zjx22OnB81bbVbX8n9u5o1wX4lBN2Eb3W8IbqkYAUdntBGEwjZY8YBo7490g42GK oTydc+bFZjueyyYMCJJdWFY74nEgFdexrop8RdOy1QxCiIDWopyKforuRLQxw1z4 CEPXWhQrmfyKOkuq4uUZvKIQZ0HsE+F8FWK5YkRsjJIg8OXjxoEoHiDCh1y0ah7I ycQXlAXa9GAal6quS0ql79WWpS+7i/VeiEO00vZaKw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopegvshgthhifrghrthiisehgvghnthhoohdrohhrghdprhgtphhtthhopehs uhhnshhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthhtohepphhhihhllh hiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtshhtvghr sehpohgsohigrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:29 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 38fbe3f0 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:26 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:28 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 07/24] t5500, t5601: skip tests which exercise paths with '[::1]' on Cygwin Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Parsing repositories which contain '[::1]' is broken on Cygwin. It seems as if Cygwin is confusing those as drive letter prefixes or something like this, but I couldn't deduce the actual root cause. Mark those tests as broken for now. Signed-off-by: Patrick Steinhardt --- t/t5500-fetch-pack.sh | 14 ++++++++++---- t/t5601-clone.sh | 11 +++++++++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 605f17240c1..416522c86ad 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -774,7 +774,7 @@ do # file with scheme for p in file do - test_expect_success !MINGW "fetch-pack --diag-url $p://$h/$r" ' + test_expect_success !WINDOWS "fetch-pack --diag-url $p://$h/$r" ' check_prot_path $p://$h/$r $p "/$r" ' test_expect_success MINGW "fetch-pack --diag-url $p://$h/$r" ' @@ -784,7 +784,7 @@ do check_prot_path $p:///$r $p "/$r" ' # No "/~" -> "~" conversion for file - test_expect_success !MINGW "fetch-pack --diag-url $p://$h/~$r" ' + test_expect_success !WINDOWS "fetch-pack --diag-url $p://$h/~$r" ' check_prot_path $p://$h/~$r $p "/~$r" ' test_expect_success MINGW "fetch-pack --diag-url $p://$h/~$r" ' @@ -806,11 +806,17 @@ do p=ssh for h in host [::1] do - test_expect_success "fetch-pack --diag-url $h:$r" ' + expectation="success" + if test_have_prereq CYGWIN && test "$h" = "[::1]" + then + expectation="failure" + fi + + test_expect_$expectation "fetch-pack --diag-url $h:$r" ' check_prot_host_port_path $h:$r $p "$h" NONE "$r" ' # Do "/~" -> "~" conversion - test_expect_success "fetch-pack --diag-url $h:/~$r" ' + test_expect_$expectation "fetch-pack --diag-url $h:/~$r" ' check_prot_host_port_path $h:/~$r $p "$h" NONE "~$r" ' done diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh index 5d7ea147f1a..9fe665eadfb 100755 --- a/t/t5601-clone.sh +++ b/t/t5601-clone.sh @@ -530,10 +530,17 @@ do ' done +# Parsing of paths that look like IPv6 addresses is broken on Cygwin. +expectation_for_ipv6_tests=success +if test_have_prereq CYGWIN +then + expectation_for_ipv6_tests=failure +fi + #ipv6 for repo in rep rep/home/project 123 do - test_expect_success "clone [::1]:$repo" ' + test_expect_$expectation_for_ipv6_tests "clone [::1]:$repo" ' test_clone_url [::1]:$repo ::1 "$repo" ' done @@ -542,7 +549,7 @@ test_expect_success "clone host:/~repo" ' test_clone_url host:/~repo host "~repo" ' -test_expect_success "clone [::1]:/~repo" ' +test_expect_$expectation_for_ipv6_tests "clone [::1]:/~repo" ' test_clone_url [::1]:/~repo ::1 "~repo" ' From patchwork Wed Oct 9 14:56:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828574 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 447C11A0B06 for ; Wed, 9 Oct 2024 14:56:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485795; cv=none; b=HePIcNzOV7tpq16vd1oWU4pcWfbN38Xv4Zuf6woXXSwI3fnKUy5TSnNyI9Bfuo8gFjIssC1mjDeNSSOQR4HO/valNVOBheUb5EqgDxivnAw1F3WjAm1p+GoeBOaEE1zMuBw1RSDy0ulozbjq+afTVaW8ybWBrvVwVUaSOa1TvQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485795; c=relaxed/simple; bh=FIU6hs/7BWhk3WVAj7yqlxmTbbCbqvKNlEvvZ8Xwzzk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=j/1HQ3syizLHWeSkTX1g0lDkbP6YutWcQASuGVNfmhSNrJo/Oz2dpeqGiaHjGNv7fmikDmMpELk+vdglkoKwANJHhaQ2GekjkqmvBF+FP1bFFfF87T1yC0I1lOAaCx2oubkMrsanRljZPELyt7cU05S/qjIUlklXc4NQ470my3M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=hpf+zMbf; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=WpfSVRHq; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="hpf+zMbf"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WpfSVRHq" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 6CE0F1140147; Wed, 9 Oct 2024 10:56:33 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 09 Oct 2024 10:56:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485793; x=1728572193; bh=khpVWHkxvO utWAYBmfmq/uTvD1WiaW8XVFJ9mTz+fTc=; b=hpf+zMbfummRMDVr+dg8+wbAq6 Apc+lFaCF5RJAhmfx7qwBkb95O6i6crKZjl1iTOILRgrnATyUn+AbcNixKZrA/L8 rCbb6u7vzKpyiy4FUea8p+hFh8dlrEqli5hCGbtukGIPk9c608jsEEWUcprR0u5F /kg0UIgFZCtHUt4Llv1YMfxjQj/dSn0dnukdDaeuz7QKOZ/q6XP2RuiMRJhdTiTs Rdf+Q/y12iH1yRdWQQn5hLDeDO+epp5qpmZJQW3eDLfDZeVetZL+K9UT5QAMYDQv dE747bWOs9A2ats4W2ZF/HJeHeOjdXoEwVRKrm7i2j5NObW+OnncAlUL6I/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485793; x=1728572193; bh=khpVWHkxvOutWAYBmfmq/uTvD1Wi aW8XVFJ9mTz+fTc=; b=WpfSVRHqZj35GIzgqySm4+2Ff95fuYVfl4mk8ZlS8tY0 u8nE04hMxRv7jgXitqCI/6bqYYNMt0ct4YdUhohOpYSnv6y5eHTAooxTGFqRY76U LVNM3WdYDWGuNwpxfk+TBpTvszXgTs2AEH9vW6PW949hQAioDiYYGNX35GwN1xEw BPrxDy98SMFAi1U633XtdqZ3pyvWmLm0CE12kKfstp9gmgDS0YwdqH8BvhoL5Qv1 MuUp7VbM5SLvU7SHTQnM5rw3oKZtPensO+/fOt5ZR0Xpoxibzr4Cb0AtiOMrOOqZ HK64z4U8lZqPJApGJOGCXi65NtMH1HxSdszScFtpcA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhgpd hrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphht thhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepphhhihhllh hiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtshhtvghr sehpohgsohigrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:32 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e24731ef (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:29 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:30 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 08/24] t7300: work around platform-specific behaviour with long paths on MinGW Message-ID: <48ce19d876f23bfc4e8601c1bcfe69ef7da407c7.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Windows by default has a restriction in place to only allow paths up to 260 characters. This restriction can nowadays be lifted by setting a registry key, but is still active by default. In t7300 we have one test that exercises the behaviour of git-clean(1) with such long paths. Interestingly enough, this test fails on my system that uses Windows 10 with mingw-w64 installed via MSYS2: instead of observing ENAMETOOLONG, we observe ENOENT. This behaviour is consistent across multiple different environments I have tried. I cannot say why exactly we observe a different error here, but I would not be surprised if this was either dependent on the Windows version, the version of MinGW, the current working directory of Git or any kind of combination of these. Work around the issue by handling both errors. Signed-off-by: Patrick Steinhardt --- t/t7300-clean.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 0aae0dee670..12ab25296b0 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -747,7 +747,7 @@ test_expect_success MINGW 'handle clean & core.longpaths = false nicely' ' test_must_fail git clean -xdf 2>.git/err && # grepping for a strerror string is unportable but it is OK here with # MINGW prereq - test_grep "too long" .git/err + test_grep -e "too long" -e "No such file or directory" .git/err ' test_expect_success 'clean untracked paths by pathspec' ' From patchwork Wed Oct 9 14:56:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828575 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 119571D271F for ; Wed, 9 Oct 2024 14:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485799; cv=none; b=g+IV2R+djIsu0OCEsiG4YVgf+i6aUwlApDxNqf6X/AgQ7zYrLhuhfHMV0z8fYMvG2Ji86WLDZIL/Rxie4AdXTo7uY0B1Fgo4FYoGMxJSulJ7kNvGBrJ8mA9RZdyrqRI1b2X0sCg+R4kJ2GbV57O617SL+d5hUeCg4lVNLogIuq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485799; c=relaxed/simple; bh=nRjQvQANSitXQM08GXmVoE5cTj8j768mq12AuLC6yVs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oYR0iBS02pP8sIXluO9NSbHMTLwGMG8wscvx2GH0IMiAPkYmVmcSNRFT/0O+tA0vrIHJEvdZtgQGr3IKsJmfQja1qWegF08DaOjyzgnnNJayJA4ZXyEK4Hggc8w/m4908GHaZElAnLgW5sRSrnnvt6G57HBmyrzxqjrb/enp06o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=LXRT94bj; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=TO6lhTAi; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="LXRT94bj"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="TO6lhTAi" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id DD78213801D8; Wed, 9 Oct 2024 10:56:35 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 09 Oct 2024 10:56:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485795; x=1728572195; bh=knIjx1uHqZ dC0LH2FqwzPOIcQzkH5kvxaqF+W6t+RVY=; b=LXRT94bjuvRgHW5DY8mGBbynF5 4nbNXrWucsawpQZOyTuzulELCf5MbrzBhi0m2lLKFvxlkFqCuZ8vkPHdsFafyYH8 mPvCNM6fShjeS1qGYMemzQX2l52Y2v7YJeTcgmzQeU7rlwEpb/eg+wb42AS/IJc2 ebdWamFMH7MFXpjcPadFJ2KGpZzZP55cMfkF4oo03Evt9ahM5BPmK5ynYl1k3z2o G/ML4QAKyN+Tz2eTcOWUAz73VdSrAMzDYQPtOfQM4bPuLKum8YZjeThGvVCWmwU3 ns4H+Xaa7l7X2MyVZLCdyUCtFFbtzzX+S83G9kAeqaaKA3OSw7ZN0Zql9BIA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485795; x=1728572195; bh=knIjx1uHqZdC0LH2FqwzPOIcQzkH 5kvxaqF+W6t+RVY=; b=TO6lhTAiK6gvPm5XRY/6xDuO9W8JReV5wCL7VVe0lrkj CAtpYR6Qtr2eMYhUKcI6JHZoVrqls/Ya0miUqjXoqtjEJE8bt8qIP0JFAfTlc+da 9OwU1ci1rybiuPleq5vKFLoFjfKvnaN3KHFzj6uqCgpOv456mGLyeZ2cnCMu7am+ ChOLzoA82YM15xuqwcpWqFv+nO9owrreCOyJ+y/gXZ0t0ZBaqnfjpk4eWegKRKUp QHbtFP010HdXL8yvMtKNSNWt9FKRl0dU66S+fTKq00a/ZDYJFQR5HYVEoBc8E+TL mPt1KbUDB3u+kgRShC56hejWJL6Wz8tj8J7bC9WW8Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhgpd hrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphhtthhopehphhhi lhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhithesvh hgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehsuhhnshhhihhnvgesshhunhhs hhhinhgvtghordgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:34 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 5ecea9c5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:31 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:33 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 09/24] t/unit-tests: update clar unit test framework Message-ID: <73b4362164ac05a4c9ce5466c266d95b2b06872a.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Update clar unit test framework to f065214 (Merge pull request #105 from pks-t/pks-win32-stat-compat, 2024-10-03), which fixes some platform compatibility issues with Windows. Signed-off-by: Patrick Steinhardt --- t/unit-tests/clar/.editorconfig | 13 +++ t/unit-tests/clar/.github/workflows/ci.yml | 20 +++- t/unit-tests/clar/.gitignore | 1 + t/unit-tests/clar/CMakeLists.txt | 28 ++++++ t/unit-tests/clar/clar.c | 111 ++++++++++----------- t/unit-tests/clar/clar/print.h | 11 +- t/unit-tests/clar/clar/sandbox.h | 17 ++-- t/unit-tests/clar/clar/summary.h | 14 +-- t/unit-tests/clar/test/.gitignore | 4 - t/unit-tests/clar/test/CMakeLists.txt | 41 ++++++++ t/unit-tests/clar/test/Makefile | 39 -------- 11 files changed, 175 insertions(+), 124 deletions(-) create mode 100644 t/unit-tests/clar/.editorconfig create mode 100644 t/unit-tests/clar/.gitignore create mode 100644 t/unit-tests/clar/CMakeLists.txt delete mode 100644 t/unit-tests/clar/test/.gitignore create mode 100644 t/unit-tests/clar/test/CMakeLists.txt delete mode 100644 t/unit-tests/clar/test/Makefile diff --git a/t/unit-tests/clar/.editorconfig b/t/unit-tests/clar/.editorconfig new file mode 100644 index 00000000000..aa343a42885 --- /dev/null +++ b/t/unit-tests/clar/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +insert_final_newline = true + +[*.{c,h}] +indent_style = tab +tab_width = 8 + +[CMakeLists.txt] +indent_style = tab +tab_width = 8 diff --git a/t/unit-tests/clar/.github/workflows/ci.yml b/t/unit-tests/clar/.github/workflows/ci.yml index b1ac2de460a..0065843d17a 100644 --- a/t/unit-tests/clar/.github/workflows/ci.yml +++ b/t/unit-tests/clar/.github/workflows/ci.yml @@ -10,14 +10,26 @@ jobs: build: strategy: matrix: - os: [ ubuntu-latest, macos-latest ] + platform: + - os: ubuntu-latest + generator: Unix Makefiles + - os: macos-latest + generator: Unix Makefiles + - os: windows-latest + generator: Visual Studio 17 2022 + - os: windows-latest + generator: MSYS Makefiles + - os: windows-latest + generator: MinGW Makefiles - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.platform.os }} steps: - name: Check out uses: actions/checkout@v2 - name: Build run: | - cd test - make + mkdir build + cd build + cmake .. -G "${{matrix.platform.generator}}" + cmake --build . diff --git a/t/unit-tests/clar/.gitignore b/t/unit-tests/clar/.gitignore new file mode 100644 index 00000000000..84c048a73cc --- /dev/null +++ b/t/unit-tests/clar/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/t/unit-tests/clar/CMakeLists.txt b/t/unit-tests/clar/CMakeLists.txt new file mode 100644 index 00000000000..12d4af114fe --- /dev/null +++ b/t/unit-tests/clar/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.16..3.29) + +project(clar LANGUAGES C) + +option(BUILD_TESTS "Build test executable" ON) + +add_library(clar INTERFACE) +target_sources(clar INTERFACE + clar.c + clar.h + clar/fixtures.h + clar/fs.h + clar/print.h + clar/sandbox.h + clar/summary.h +) +set_target_properties(clar PROPERTIES + C_STANDARD 90 + C_STANDARD_REQUIRED ON + C_EXTENSIONS OFF +) + +if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(CTest) + if(BUILD_TESTING) + add_subdirectory(test) + endif() +endif() diff --git a/t/unit-tests/clar/clar.c b/t/unit-tests/clar/clar.c index cef0f023c24..12fa66d088a 100644 --- a/t/unit-tests/clar/clar.c +++ b/t/unit-tests/clar/clar.c @@ -4,7 +4,8 @@ * This file is part of clar, distributed under the ISC license. * For full terms see the included COPYING file. */ -#include + +#include #include #include #include @@ -13,6 +14,7 @@ #include #include #include +#include /* required for sandboxing */ #include @@ -28,6 +30,9 @@ # ifndef stat # define stat(path, st) _stat(path, st) + typedef struct _stat STAT_T; +# else + typedef struct stat STAT_T; # endif # ifndef mkdir # define mkdir(path, mode) _mkdir(path) @@ -60,30 +65,11 @@ # else # define p_snprintf snprintf # endif - -# ifndef PRIuZ -# define PRIuZ "Iu" -# endif -# ifndef PRIxZ -# define PRIxZ "Ix" -# endif - -# if defined(_MSC_VER) || (defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)) - typedef struct stat STAT_T; -# else - typedef struct _stat STAT_T; -# endif #else # include /* waitpid(2) */ # include # define _MAIN_CC # define p_snprintf snprintf -# ifndef PRIuZ -# define PRIuZ "zu" -# endif -# ifndef PRIxZ -# define PRIxZ "zx" -# endif typedef struct stat STAT_T; #endif @@ -102,7 +88,7 @@ fixture_path(const char *base, const char *fixture_name); struct clar_error { const char *file; const char *function; - size_t line_number; + uintmax_t line_number; const char *error_msg; char *description; @@ -195,11 +181,12 @@ static void clar_print_shutdown(int test_count, int suite_count, int error_count static void clar_print_error(int num, const struct clar_report *report, const struct clar_error *error); static void clar_print_ontest(const char *suite_name, const char *test_name, int test_number, enum cl_test_status failed); static void clar_print_onsuite(const char *suite_name, int suite_index); +static void clar_print_onabortv(const char *msg, va_list argp); static void clar_print_onabort(const char *msg, ...); /* From clar_sandbox.c */ static void clar_unsandbox(void); -static int clar_sandbox(void); +static void clar_sandbox(void); /* From summary.h */ static struct clar_summary *clar_summary_init(const char *filename); @@ -218,6 +205,15 @@ static int clar_summary_shutdown(struct clar_summary *fp); _clar.trace_payload); \ } while (0) +static void clar_abort(const char *msg, ...) +{ + va_list argp; + va_start(argp, msg); + clar_print_onabortv(msg, argp); + va_end(argp); + exit(-1); +} + void cl_trace_register(cl_trace_cb *cb, void *payload) { _clar.pfn_trace_cb = cb; @@ -271,9 +267,7 @@ static double clar_time_diff(clar_time *start, clar_time *end) static void clar_time_now(clar_time *out) { - struct timezone tz; - - gettimeofday(out, &tz); + gettimeofday(out, NULL); } static double clar_time_diff(clar_time *start, clar_time *end) @@ -386,7 +380,8 @@ clar_run_suite(const struct clar_suite *suite, const char *filter) _clar.active_test = test[i].name; - report = calloc(1, sizeof(struct clar_report)); + if ((report = calloc(1, sizeof(*report))) == NULL) + clar_abort("Failed to allocate report.\n"); report->suite = _clar.active_suite; report->test = _clar.active_test; report->test_number = _clar.tests_ran; @@ -479,9 +474,10 @@ clar_parse_args(int argc, char **argv) switch (action) { case 's': { - struct clar_explicit *explicit = - calloc(1, sizeof(struct clar_explicit)); - assert(explicit); + struct clar_explicit *explicit; + + if ((explicit = calloc(1, sizeof(*explicit))) == NULL) + clar_abort("Failed to allocate explicit test.\n"); explicit->suite_idx = j; explicit->filter = argument; @@ -505,10 +501,8 @@ clar_parse_args(int argc, char **argv) } } - if (!found) { - clar_print_onabort("No suite matching '%s' found.\n", argument); - exit(-1); - } + if (!found) + clar_abort("No suite matching '%s' found.\n", argument); break; } @@ -540,11 +534,17 @@ clar_parse_args(int argc, char **argv) case 'r': _clar.write_summary = 1; free(_clar.summary_filename); - _clar.summary_filename = *(argument + 2) ? strdup(argument + 2) : NULL; + if (*(argument + 2)) { + if ((_clar.summary_filename = strdup(argument + 2)) == NULL) + clar_abort("Failed to allocate summary filename.\n"); + } else { + _clar.summary_filename = NULL; + } break; default: - assert(!"Unexpected commandline argument!"); + clar_abort("Unexpected commandline argument '%s'.\n", + argument[1]); } } } @@ -566,22 +566,18 @@ clar_test_init(int argc, char **argv) if (!_clar.summary_filename && (summary_env = getenv("CLAR_SUMMARY")) != NULL) { _clar.write_summary = 1; - _clar.summary_filename = strdup(summary_env); + if ((_clar.summary_filename = strdup(summary_env)) == NULL) + clar_abort("Failed to allocate summary filename.\n"); } if (_clar.write_summary && !_clar.summary_filename) - _clar.summary_filename = strdup("summary.xml"); + if ((_clar.summary_filename = strdup("summary.xml")) == NULL) + clar_abort("Failed to allocate summary filename.\n"); - if (_clar.write_summary && - !(_clar.summary = clar_summary_init(_clar.summary_filename))) { - clar_print_onabort("Failed to open the summary file\n"); - exit(-1); - } + if (_clar.write_summary) + _clar.summary = clar_summary_init(_clar.summary_filename); - if (clar_sandbox() < 0) { - clar_print_onabort("Failed to sandbox the test runner.\n"); - exit(-1); - } + clar_sandbox(); } int @@ -615,10 +611,9 @@ clar_test_shutdown(void) clar_unsandbox(); - if (_clar.write_summary && clar_summary_shutdown(_clar.summary) < 0) { - clar_print_onabort("Failed to write the summary file\n"); - exit(-1); - } + if (_clar.write_summary && clar_summary_shutdown(_clar.summary) < 0) + clar_abort("Failed to write the summary file '%s: %s.\n", + _clar.summary_filename, strerror(errno)); for (explicit = _clar.explicit; explicit; explicit = explicit_next) { explicit_next = explicit->next; @@ -649,7 +644,7 @@ static void abort_test(void) { if (!_clar.trampoline_enabled) { clar_print_onabort( - "Fatal error: a cleanup method raised an exception."); + "Fatal error: a cleanup method raised an exception.\n"); clar_report_errors(_clar.last_report); exit(-1); } @@ -673,7 +668,10 @@ void clar__fail( const char *description, int should_abort) { - struct clar_error *error = calloc(1, sizeof(struct clar_error)); + struct clar_error *error; + + if ((error = calloc(1, sizeof(*error))) == NULL) + clar_abort("Failed to allocate error.\n"); if (_clar.last_report->errors == NULL) _clar.last_report->errors = error; @@ -688,8 +686,9 @@ void clar__fail( error->line_number = line; error->error_msg = error_msg; - if (description != NULL) - error->description = strdup(description); + if (description != NULL && + (error->description = strdup(description)) == NULL) + clar_abort("Failed to allocate description.\n"); _clar.total_errors++; _clar.last_report->status = CL_TEST_FAILURE; @@ -798,8 +797,8 @@ void clar__assert_equal( } } } - else if (!strcmp("%"PRIuZ, fmt) || !strcmp("%"PRIxZ, fmt)) { - size_t sz1 = va_arg(args, size_t), sz2 = va_arg(args, size_t); + else if (!strcmp("%"PRIuMAX, fmt) || !strcmp("%"PRIxMAX, fmt)) { + uintmax_t sz1 = va_arg(args, uintmax_t), sz2 = va_arg(args, uintmax_t); is_equal = (sz1 == sz2); if (!is_equal) { int offset = p_snprintf(buf, sizeof(buf), fmt, sz1); diff --git a/t/unit-tests/clar/clar/print.h b/t/unit-tests/clar/clar/print.h index c17e2f693bd..69d0ee967e7 100644 --- a/t/unit-tests/clar/clar/print.h +++ b/t/unit-tests/clar/clar/print.h @@ -21,7 +21,7 @@ static void clar_print_clap_error(int num, const struct clar_report *report, con { printf(" %d) Failure:\n", num); - printf("%s::%s [%s:%"PRIuZ"]\n", + printf("%s::%s [%s:%"PRIuMAX"]\n", report->suite, report->test, error->file, @@ -136,7 +136,7 @@ static void clar_print_tap_ontest(const char *suite_name, const char *test_name, printf(" at:\n"); printf(" file: '"); print_escaped(error->file); printf("'\n"); - printf(" line: %" PRIuZ "\n", error->line_number); + printf(" line: %" PRIuMAX "\n", error->line_number); printf(" function: '%s'\n", error->function); printf(" ---\n"); @@ -202,10 +202,15 @@ static void clar_print_onsuite(const char *suite_name, int suite_index) PRINT(onsuite, suite_name, suite_index); } +static void clar_print_onabortv(const char *msg, va_list argp) +{ + PRINT(onabort, msg, argp); +} + static void clar_print_onabort(const char *msg, ...) { va_list argp; va_start(argp, msg); - PRINT(onabort, msg, argp); + clar_print_onabortv(msg, argp); va_end(argp); } diff --git a/t/unit-tests/clar/clar/sandbox.h b/t/unit-tests/clar/clar/sandbox.h index e25057b7c49..681a1f80f17 100644 --- a/t/unit-tests/clar/clar/sandbox.h +++ b/t/unit-tests/clar/clar/sandbox.h @@ -122,14 +122,14 @@ static int build_sandbox_path(void) if (mkdir(_clar_path, 0700) != 0) return -1; -#elif defined(__TANDEM) - if (mktemp(_clar_path) == NULL) +#elif defined(_WIN32) + if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0) return -1; if (mkdir(_clar_path, 0700) != 0) return -1; -#elif defined(_WIN32) - if (_mktemp_s(_clar_path, sizeof(_clar_path)) != 0) +#elif defined(__TANDEM) + if (mktemp(_clar_path) == NULL) return -1; if (mkdir(_clar_path, 0700) != 0) @@ -142,15 +142,14 @@ static int build_sandbox_path(void) return 0; } -static int clar_sandbox(void) +static void clar_sandbox(void) { if (_clar_path[0] == '\0' && build_sandbox_path() < 0) - return -1; + clar_abort("Failed to build sandbox path.\n"); if (chdir(_clar_path) != 0) - return -1; - - return 0; + clar_abort("Failed to change into sandbox directory '%s': %s.\n", + _clar_path, strerror(errno)); } const char *clar_sandbox_path(void) diff --git a/t/unit-tests/clar/clar/summary.h b/t/unit-tests/clar/clar/summary.h index 4dd352e28b8..0d0b646fe75 100644 --- a/t/unit-tests/clar/clar/summary.h +++ b/t/unit-tests/clar/clar/summary.h @@ -66,16 +66,12 @@ struct clar_summary *clar_summary_init(const char *filename) struct clar_summary *summary; FILE *fp; - if ((fp = fopen(filename, "w")) == NULL) { - perror("fopen"); - return NULL; - } + if ((fp = fopen(filename, "w")) == NULL) + clar_abort("Failed to open the summary file '%s': %s.\n", + filename, strerror(errno)); - if ((summary = malloc(sizeof(struct clar_summary))) == NULL) { - perror("malloc"); - fclose(fp); - return NULL; - } + if ((summary = malloc(sizeof(struct clar_summary))) == NULL) + clar_abort("Failed to allocate summary.\n"); summary->filename = filename; summary->fp = fp; diff --git a/t/unit-tests/clar/test/.gitignore b/t/unit-tests/clar/test/.gitignore deleted file mode 100644 index a477d0c40ca..00000000000 --- a/t/unit-tests/clar/test/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -clar.suite -.clarcache -clar_test -*.o diff --git a/t/unit-tests/clar/test/CMakeLists.txt b/t/unit-tests/clar/test/CMakeLists.txt new file mode 100644 index 00000000000..4c9012d0611 --- /dev/null +++ b/t/unit-tests/clar/test/CMakeLists.txt @@ -0,0 +1,41 @@ +find_package(Python COMPONENTS Interpreter REQUIRED) + +add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/clar.suite" + COMMAND "${Python_EXECUTABLE}" "${CMAKE_SOURCE_DIR}/generate.py" --output "${CMAKE_CURRENT_BINARY_DIR}" + DEPENDS main.c sample.c clar_test.h + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" +) + +add_executable(clar_test) +set_target_properties(clar_test PROPERTIES + C_STANDARD 90 + C_STANDARD_REQUIRED ON + C_EXTENSIONS OFF +) + +# MSVC generates all kinds of warnings. We may want to fix these in the future +# and then unconditionally treat warnings as errors. +if(NOT MSVC) + set_target_properties(clar_test PROPERTIES + COMPILE_WARNING_AS_ERROR ON + ) +endif() + +target_sources(clar_test PRIVATE + main.c + sample.c + "${CMAKE_CURRENT_BINARY_DIR}/clar.suite" +) +target_compile_definitions(clar_test PRIVATE + CLAR_FIXTURE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/" + _DARWIN_C_SOURCE + _POSIX_C_SOURCE=200809L +) +target_compile_options(clar_test PRIVATE + $,/W4,-Wall> +) +target_include_directories(clar_test PRIVATE + "${CMAKE_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}" +) +target_link_libraries(clar_test clar) diff --git a/t/unit-tests/clar/test/Makefile b/t/unit-tests/clar/test/Makefile deleted file mode 100644 index 93c6b2ad32c..00000000000 --- a/t/unit-tests/clar/test/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) Vicent Marti. All rights reserved. -# -# This file is part of clar, distributed under the ISC license. -# For full terms see the included COPYING file. -# - -# -# Set up the path to the clar sources and to the fixtures directory -# -# The fixture path needs to be an absolute path so it can be used -# even after we have chdir'ed into the test directory while testing. -# -CURRENT_MAKEFILE := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) -TEST_DIRECTORY := $(abspath $(dir $(CURRENT_MAKEFILE))) -CLAR_PATH := $(dir $(TEST_DIRECTORY)) -CLAR_FIXTURE_PATH := $(TEST_DIRECTORY)/resources/ - -CFLAGS=-g -I.. -I. -Wall -DCLAR_FIXTURE_PATH=\"$(CLAR_FIXTURE_PATH)\" - -.PHONY: clean - -# list the objects that go into our test -objects = main.o sample.o - -# build the test executable itself -clar_test: $(objects) clar_test.h clar.suite $(CLAR_PATH)clar.c - $(CC) $(CFLAGS) -o $@ "$(CLAR_PATH)clar.c" $(objects) - -# test object files depend on clar macros -$(objects) : $(CLAR_PATH)clar.h - -# build the clar.suite file of test metadata -clar.suite: - python "$(CLAR_PATH)generate.py" . - -# remove all generated files -clean: - $(RM) -rf *.o clar.suite .clarcache clar_test clar_test.dSYM From patchwork Wed Oct 9 14:56:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828576 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4178A19F402 for ; Wed, 9 Oct 2024 14:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485800; cv=none; b=WqofVHyKla3m322Pyn+mWr1/EZ63OSsDiRPhCFrP3nQrl57gJcXHSug9CxHyk2ynZPKGV7xzeSuoohzNEUqdBqMHyWE2JDwa1sc/n3b+q1v8lmhtRpR6ZuKjnW3kwUtT1M6HlgTo4sJnl3yiZ1Xk1b33ieqpbxJOlQXj4qpDFGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485800; c=relaxed/simple; bh=OSLp0anec5VzID3xwgHW+Bx0ysfm1q/NlbNeqLFAAHc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KfQc7ImkAgPDMeh5Ytc9GYENuiybc515D80+vYtBlBcb2RbiYcGCG1by79lKQ+P8AP6Twy3/B2dXDCotWxFZfo7+2195U5I9eHcy2vq/ovTeetlelHwl8TQfnwmI5E7C7807q7lvad9nkORk/OEke3LyDYYiAXO8kQeC/7cQ0NE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=R2bzkHc/; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=k0mF0iHy; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="R2bzkHc/"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="k0mF0iHy" Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 6800813801EF; Wed, 9 Oct 2024 10:56:38 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Wed, 09 Oct 2024 10:56:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485798; x=1728572198; bh=hfc6lJ6toT Dn58jdjgmZsXqX6d7MkdF7KXYXSz1eaOI=; b=R2bzkHc/5TYYd0rJ3Y/uno+pIX ckhM3qDbuY9mKAZ5ECtZ6Ae556dg2o/tGk82D++D8iFxXT0qreyz2qJiK6WrRczt mJdQ7t3q+ByKoT2rO+mYTwNjmwSph+Eb+dz/oyjGToitJ+fwLyW1VSvD741KIuyx oFIv6n90gjCvLHKqp2K+EoTuWHKNAM/5cyOZ6kxl1PvufDTnPeqIrR3QzvH4Y86h nDXD2fTkJaNFWd6SxGezYgv2uxkO3r1TmIxbgN+9y7tL6eBPcDKRdMLNantLe1tO KyLDg4BMcWQ+5SNghWoq84L0dNSagQuhREhli3s34hLGHGQtDN5g3aDoEC2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485798; x=1728572198; bh=hfc6lJ6toTDn58jdjgmZsXqX6d7M kdF7KXYXSz1eaOI=; b=k0mF0iHywwIz3uPcIBn+vRQ7zcE5OGuhlvkWiARF/paF akhSif86KeN9SUokKMM2kFhukgBXNR7EbFYhNBy9WlfWZOpQ5d4z1mJvjLaifPYI qGHeQBxiMi+C68tBZgZJ8yOALAe1mwAgYpttM8l/DhwJRrqhBE/iCI8yqt/amAhG IoTo0HE5zkgxNS6qqy57Lqyz8nGGl4Lx5kCpZVolkWnYQvUTRy0PBr/8sPsdZaDM TmmhPyY3KMxLYk2OPB6nwkyfiqqHomhPlGEZgfBOhi6YgUCTFFYxpxSCPm9ZYld3 XwUx2iFKsQmaMYYuK/ztytebeK01CaH3vpnH1Er/yA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilh drtghomhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghp thhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphhtthhopehsuhhnshhhih hnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthhtohepvghstghhfigrrhhtiies ghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:37 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 6c44e6e5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:34 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:36 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 10/24] builtin/credential-cache: fix missing parameter for stub function Message-ID: <161f6b063afcaab69bb0c930ddf0d9ad188a1d05.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: When not compiling the credential cache we may use a stub function for `cmd_credential_cache()`. With commit 9b1cb5070f (builtin: add a repository parameter for builtin functions, 2024-09-13), we have added a new parameter to all of those top-level `cmd_*()` functions, and did indeed adapt the non-stubbed-out `cmd_credential_cache()`. But we didn't adapt the stubbed-out variant, so the code does not compile. Fix this by adding the missing parameter. Signed-off-by: Patrick Steinhardt --- builtin/credential-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index 5de8b9123bf..c51f7fc2ade 100644 --- a/builtin/credential-cache.c +++ b/builtin/credential-cache.c @@ -189,7 +189,8 @@ int cmd_credential_cache(int argc, #else -int cmd_credential_cache(int argc, const char **argv, const char *prefix) +int cmd_credential_cache(int argc, const char **argv, const char *prefix, + struct repository *repo UNUSED) { const char * const usage[] = { "git credential-cache [options] ", From patchwork Wed Oct 9 14:56:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828577 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87F5E19ABB4 for ; Wed, 9 Oct 2024 14:56:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485804; cv=none; b=suc+my6yb5ddePn+VtVfXwO1qPmfRJzG6XOzIhEGs4QHfNP2e7daFuexbo9fwMyFs/hUWTmlPEkVuRALlbUiMa6pBXC9aPhoqvsIe0TNm4b3Oy8Z85UbPh052v+Yoyrhan0rnwTVnravYgm6yNcTl4p1XddpEU59AX5Yp4pzRTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485804; c=relaxed/simple; bh=kNfiY0nZiQdr8/PQWWx8B/jOLPij4m/0of+73XP5QNE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qXb+6uBD5QwAZ2ezEYlUPEMFPNou5aNX2S0EZIBl6NPQmu2A6Ly1KmI2AL1Mp2n/09cq/phm0dc2D6MGyNr4zQhjRkSZj0WDuGxuLTVhnZbnRKWO4rJlp88rLzo9oNlWqPgN0n9wA8K752UKNPvvnM0SMbRzqkMAtNigagNCdKw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=e8TagWIL; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=LMDH92Zq; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="e8TagWIL"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="LMDH92Zq" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id CED821140170; Wed, 9 Oct 2024 10:56:41 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 09 Oct 2024 10:56:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485801; x=1728572201; bh=Bogt4+iT0R BusDmJrhAyRYq1hr55jIYxp2MCUYsPP8s=; b=e8TagWILvah095e1e+5+WZ/oEE Cx9ih8gA0M6y8UfEAu/vtBOVoz8WDJ+P9BjxAXnrdYSoA6sssjCF1DHjljkopV1W rgsYE2jKtjU8kZSETw/ENoZ6TsL8W5NfftVZxehqgM9bzwW7J0DR3V1psj1sOO/b 4W+JDv0EvsrO+4T9tLvvqCk3zEE/2aljwnQr1xe+G5AdaqT43gN3veJGBqb7BJhM ELE2LxoqJxT0AEOS5oQgAOs4DIfGfTCSXM88yltikGRUih+IcRjTXgnPRS/+O20w SRpjYvD9ShoMtkFQ45AE2kH8BhkYmfu6yudIfmutWS4KaR8Wf8RPcEZT3Kgw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485801; x=1728572201; bh=Bogt4+iT0RBusDmJrhAyRYq1hr55 jIYxp2MCUYsPP8s=; b=LMDH92ZqPYbQ/T9PlDw50v8cStwye5IfqI/kEWOZobRf EXp8QZKZCmP5VFkjygGl0D1EKhdNv7XrJ/LDCv8iX5OAnBbgxxw6ukE0dP6WWOq9 iH58RN0eJJy8wOYcSTei9DpjnRDS5OCmRhLgYS3IIYsKCYkJDR1+Asws5H/fAY/M N9orIkrVM4BDCzJw4BeNmPqeygBJpOu/ALFrcyQcwkhDGmfmhChxqFy+QuZ1Tybh y65K79ui09E0iL573gv3d5PilHK9SjTswgp7D3iz9nq2JTJ0nVKXuW/dVik7lR5I MG8tTCCZ4SKb1iu3hY1J96/eKum73U1Yz3WphLusbA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopehphhhilhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthht ohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopegvshgthhifrg hrthiisehgvghnthhoohdrohhrghdprhgtphhtthhopehsuhhnshhhihhnvgesshhunhhs hhhinhgvtghordgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:40 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f4a60c0c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:37 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:38 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 11/24] http: fix build error on FreeBSD Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The `result` parameter passed to `http_request_reauth()` may either point to a `struct strbuf` or a `FILE *`, where the `target` parameter tells us which of either it actually is. To accommodate for both types the pointer is a `void *`, which we then pass directly to functions without doing a cast. This is fine on most platforms, but it breaks on FreeBSD because `fileno()` is implemented as a macro that tries to directly access the `FILE *` structure. Fix this issue by storing the `FILE *` in a local variable before we pass it on to other functions. Signed-off-by: Patrick Steinhardt --- http.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/http.c b/http.c index d59e59f66b1..72973175a85 100644 --- a/http.c +++ b/http.c @@ -2290,17 +2290,19 @@ static int http_request_reauth(const char *url, case HTTP_REQUEST_STRBUF: strbuf_reset(result); break; - case HTTP_REQUEST_FILE: - if (fflush(result)) { + case HTTP_REQUEST_FILE: { + FILE *f = result; + if (fflush(f)) { error_errno("unable to flush a file"); return HTTP_START_FAILED; } - rewind(result); - if (ftruncate(fileno(result), 0) < 0) { + rewind(f); + if (ftruncate(fileno(f), 0) < 0) { error_errno("unable to truncate a file"); return HTTP_START_FAILED; } break; + } default: BUG("Unknown http_request target"); } From patchwork Wed Oct 9 14:56:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828578 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 510C719ABB4 for ; Wed, 9 Oct 2024 14:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485807; cv=none; b=KMMBqLhLlf8pj10jyqonDlxN1BSf6JNxxXEE5TWJGKZHeGpMX43ZvXY+/s+twouPqbOBMfojK+/m6vlwsIgixuge/L/2w/RNtCM61AzsMjsP9zl6VHepLUZpr1rOekBgzHYaRIPNyjGticcGt6J3bxlSZ0yweqTQe4i2MyKBdfg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485807; c=relaxed/simple; bh=eZDN8vTPDZkLkCbsgVDKUtL8DHla4HnHRiZI5yXLqjE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ORqwxgYYCLrbZr8MUj1Ef1H1vB60VPhDr14zXcLJzMmRgcBVF/JqLamBbJTApeL4T/PLbcfgjiIpGh+GsgDnfTEnLxBcrCFXn1pLV4Tuw4bmszTTBNnRZda+EqirInjSJBN+iWasaCDaSxgeuYzp69x98bk6Woaz7HA82EYYm1I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=MFL85whz; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=hTadlg83; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="MFL85whz"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="hTadlg83" Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5934111401C0; Wed, 9 Oct 2024 10:56:45 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Wed, 09 Oct 2024 10:56:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485805; x=1728572205; bh=5DiS/1/xM3 0Sr1Il2mV2ExXQNnP7gvUibDkC05llDI0=; b=MFL85whz2enQH6cEjBtnpiu6f3 lh4dgsVrdFWip5N5v0Fxws45Hk5MurkBrAc6VflGGxaWnlIPuZNGShDp5Y2lRdid KatKZZWH3/dfou9lusmk+dJZr3kJkNMaTX27AVCnFBV8ulhmoR84OOPryrUpJPqI gkIgDSJxOsfJSFLxDJzv3J7uDa+E3sHqQqTOCdjIoMhcXVDct2GX8kFQ5V6aDuzL wgWih78PfGSuXNp8vUf1CSf9HpTtz7honFLb1WxQ5eb4XSQsH2lOnGCL4FVox3Jy Qfa+0B+ocCU7pWapxnox7E21JasNXRignVnSewEbaTbieM5yovXhLjzl34Og== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485805; x=1728572205; bh=5DiS/1/xM30Sr1Il2mV2ExXQNnP7 gvUibDkC05llDI0=; b=hTadlg83Fg40o08ebUfBNCCaihKAgHIuFgqSowLbl77J LDyfYkCrvDdp+HjsgDI/Cd5HPh+FFq4bfmjv+toshJ//qfQFFutMNghuM/Zd+dPw LxYysOGz/p2M52rxypc53WbbbEnZPSnLhBwogNXwJmxMwPH8z+GwJIrKMMSmii51 1fx44IxPav9IM8QEYsS6G9GR2RmdHMw9LggJWaSGvvFC/7aciNL43GRlhSFUS30c gOypKpk4vLKWB91fXqxQ+1PtV7kuKHR1Sp5SIXDrQSXHL3/TPmPwFhSfkSPvcHQQ YCdg9ijWJmxNAgdlPtkwUEky5t4IR7TRJJvSyjlJ5g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhgpd hrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphhtthhopehsuhhn shhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthhtohepghhithesvhhgvg hrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdef sehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:43 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 6b693e43 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:41 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:41 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 12/24] Makefile: extract script to generate clar declarations Message-ID: <6ea97bc92f2ae09d406c445fd8dad1fe803cec19.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Extract the script to generate function declarations for the clar unit testing framework into a standalone script. This is done such that we can reuse it in other build systems. Signed-off-by: Patrick Steinhardt --- Makefile | 4 +--- t/unit-tests/generate-clar-decls.sh | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100755 t/unit-tests/generate-clar-decls.sh diff --git a/Makefile b/Makefile index c094840426c..0d542c58f3a 100644 --- a/Makefile +++ b/Makefile @@ -3906,9 +3906,7 @@ GIT-TEST-SUITES: FORCE fi $(UNIT_TEST_DIR)/clar-decls.h: $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) GIT-TEST-SUITES - $(QUIET_GEN)for suite in $(CLAR_TEST_SUITES); do \ - sed -ne "s/^\(void test_$${suite}__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$$\)/extern \1;/p" $(UNIT_TEST_DIR)/$$suite.c; \ - done >$@ + $(QUIET_GEN)$(SHELL_PATH) $(UNIT_TEST_DIR)/generate-clar-decls.sh "$@" $(patsubst %,$(UNIT_TEST_DIR)/%.c,$(CLAR_TEST_SUITES)) $(UNIT_TEST_DIR)/clar.suite: $(UNIT_TEST_DIR)/clar-decls.h $(QUIET_GEN)awk -f $(UNIT_TEST_DIR)/clar-generate.awk $< >$(UNIT_TEST_DIR)/clar.suite $(CLAR_TEST_OBJS): $(UNIT_TEST_DIR)/clar-decls.h diff --git a/t/unit-tests/generate-clar-decls.sh b/t/unit-tests/generate-clar-decls.sh new file mode 100755 index 00000000000..6646a90f711 --- /dev/null +++ b/t/unit-tests/generate-clar-decls.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +if test $# -lt 2 +then + echo "USAGE: $0 ..." 2>&1 + exit 1 +fi + +OUTPUT="$1" +shift + +while test "$#" -ne 0 +do + suite="$1" + shift + sed -ne "s/^\(void test_$suite__[a-zA-Z_0-9][a-zA-Z_0-9]*(void)$\)/extern \1;/p" "$suite" || + exit 1 +done >"$OUTPUT" From patchwork Wed Oct 9 14:56:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828579 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3DB31DEFF0 for ; Wed, 9 Oct 2024 14:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485811; cv=none; b=RE0j+uvQtj/C1+a6tVw2O/jPaQtD5koTiXsFyvaywEuoy0P8gE2WSiFFnb/eqw3aFRaQglXgZrsHznvIGdq9+Mblbg5WOvYfNLSTxa2UZbD9lGqC7q7U9Z8AUO1xh1t7xM9sp+QgOK7d0c7GSXQyEDDoy57EamFN0AjrUX62cSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485811; c=relaxed/simple; bh=SLdTqxSlyXH68V1nqHRtdOi3MlKQlNzre+BYo1l8TZo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Wmaap+K4+gxzKsOoaF2oqaFD1eMoLuKShlA9B9mCBRmgKmlLqRt11hXYbV+zUiUaOXJW9FJF9eOEzxV5q+6G/OikFsQL+rs0uQrjJMurBVrtB7E2/fGRlFXERSDorfn7rvG3iyjS64XIb5xxQhW0awzc7A8hr+Y6urqIdW4ozis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=SxSq+Wbp; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=mddyFutF; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="SxSq+Wbp"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mddyFutF" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id D2ECF13801C2; Wed, 9 Oct 2024 10:56:48 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 09 Oct 2024 10:56:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485808; x=1728572208; bh=zXCzswH6p1 bB7+oTa1qN17e3pkC6PAqW+fT+rqPq7YM=; b=SxSq+WbpJ9yfmHlY4KpHku3RI2 JrnNBu7Pwno1tkPU6p14cGKVzbtfqvrVxm/fwiFOF4kctV1zs9X75lziZ1HKvUVQ BemyiDHQaF3x1JwiQlFL+vFI8lzev49l64io/7Jcfv2ZFlNSFU+u595gHviClLhQ a2o8Z2PWvB/EDerrtaAmdRFtipIYKOX2R5ibWCu7JnPnzLqJlCoM8Ig76gV6Fim9 v2NZ9FdaZPs2nStigeWmX2UDyYl27Tps/Bslkrqp3u9ns1sIlpxozv4J+ADwALy/ nG+7x/xysti1UYpQBfez3atRNht2+V4q9rsf3z1C/wQWQv4XOyCIYazpBu4A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485808; x=1728572208; bh=zXCzswH6p1bB7+oTa1qN17e3pkC6 PAqW+fT+rqPq7YM=; b=mddyFutFPTjj3QrxIkhx9yCj2Sc55wY3bdvTHBufVZE5 kfvm+xfbxohGQ/f5Ij7RiNFsH50fTU0JVSbI2nTH3aFp7jFDmLfrx6UwUdAzNrux NeUOol4qI/YUAUQjtrLun8zzgVWfYKWJzpyi5iCLJpw5POZVrfjM6cs4iWLMjGeI C0I6auYs6PF3BYVxUxy2x+8RmSYX7oizeJFhfBbCwxi6XNceCz44sEeXvncdKjJY oziHin2+uI2QjLa4Xbu0palNpsmXar8eIsddCH1QtRsvMcSLrBBmtEcR/SY6oQ8c Dsc0GG+BKl+rORte2wFMc1b6G9hvCWBFv+TxJtrXug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepvghstghh figrrhhtiiesghgvnhhtohhordhorhhgpdhrtghpthhtohepshhunhhshhhinhgvsehsuh hnshhhihhnvggtohdrtghomhdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdef sehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:47 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id d5d3dbc2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:44 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:45 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 13/24] Makefile: extract script to massage Perl scripts Message-ID: <7f567d7ce237460e37b8eae29d14c453f95f3e94.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Extract the script to inject various build-time parameters into our Perl scripts into a standalone script. This is done such that we can reuse it in other build systems. Signed-off-by: Patrick Steinhardt --- Makefile | 10 +--------- generate-perl.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100755 generate-perl.sh diff --git a/Makefile b/Makefile index 0d542c58f3a..50fbc4f29d0 100644 --- a/Makefile +++ b/Makefile @@ -2605,15 +2605,7 @@ endif PERL_DEFINES += $(gitexecdir) $(perllibdir) $(localedir) $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE - $(QUIET_GEN) \ - sed -e '1{' \ - -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ - -e ' r GIT-PERL-HEADER' \ - -e ' G' \ - -e '}' \ - -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ - $< >$@+ && \ - chmod +x $@+ && \ + $(QUIET_GEN)$(SHELL_PATH) generate-perl.sh $(GIT_VERSION) GIT-PERL-HEADER "$(PERL_PATH_SQ)" "$<" "$@+" && \ mv $@+ $@ PERL_DEFINES := $(subst $(space),:,$(PERL_DEFINES)) diff --git a/generate-perl.sh b/generate-perl.sh new file mode 100755 index 00000000000..b9e04d6f42a --- /dev/null +++ b/generate-perl.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +if test $# -ne 5 +then + echo "USAGE: $0 " >&2 + exit 1 +fi + +GIT_VERSION="$1" +PERL_HEADER="$2" +PERL_PATH="$3" +PERL_SCRIPT="$4" +OUT="$5" + +sed -e '1{' \ + -e " s|#!.*perl|#!$PERL_PATH|" \ + -e " r $PERL_HEADER" \ + -e ' G' \ + -e '}' \ + -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \ + "$PERL_SCRIPT" >"$OUT" +chmod a+x "$OUT" From patchwork Wed Oct 9 14:56:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828580 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D26D1A262D for ; Wed, 9 Oct 2024 14:56:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485813; cv=none; b=G3bgSN7W+2mCb1CktWTT3u1AjVVN6uhriRKXi1hGp3+qmLag5C2HA7U6/Mf32lVKo4ZiZ6TCQqVxPMD6rrwq+xH9CY/xbyT2NK5AKFthtA7/ZHTT+eu8Xaky/SI1NpEbtuEc6jwI7jYTlSOl4jkj1ctW4XY2WfjeVbeecAJVYgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485813; c=relaxed/simple; bh=cutmeHvdZU8iCvZtCsqtwAv9/yo1Q1IJBbR8Bzw/FVk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iUTCkktsseEJtigLzVAKZ7WnJV9RwP280gktXzgv+AypAcUkjbYPtGqSA6WCpbJbbXCnwytcv+tjCWXtdVlio6kSXHgEJ1VkugQO9htnRCctS04dN4ef6FKDTPjnyGiSAVZy+WiLLoSnadL2P82+pRnRXdXhGZLthyjP5tioEn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=kZuzDkbV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=M71aXGIl; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="kZuzDkbV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="M71aXGIl" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfhigh.phl.internal (Postfix) with ESMTP id 57CC71140170; Wed, 9 Oct 2024 10:56:51 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 09 Oct 2024 10:56:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485811; x=1728572211; bh=tOav+8enP4 GrF/lCB2i7kBctBDEpSRbTqU/IM1XtpD0=; b=kZuzDkbVkEGtwy1iy0c9SAKrSD CkUxoxcitqxtoQkdQXGw4zXJjmE2YRhp5E5wyM6bfCol0no2o8lMR94LwEEtWZUf waeYp0bmLPOBtrptnKGHMcEhRPKXAiX/EcOENYcPET5BR75jfYAfKw/WpyKuAYq8 IYq38tBCutUbsRKcBZUfnRJ9WGOrKmR143GoxG8w8scVX0ehz/WGJA3cM/V3JlOK k7YH3nMeByJVCr3LlaP2VfuIoGdjmadm20I10OB3fdO4JhTMwnbogJSwXVbdLkTQ 28OOZn+04JKgKWhWq9YcBhnq4IDu2ZPJB6aVqwqwPtwcbWDIuy5LDT3TQNKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485811; x=1728572211; bh=tOav+8enP4GrF/lCB2i7kBctBDEp SRbTqU/IM1XtpD0=; b=M71aXGIlf4awwMdCKBZlxJfI7+pTMpjKazUiFjwvS3mQ dFnGCB/BzDmeqsFX50kpKxBJ4e6iwTH7YCiBBoJn+D3gMAQnf4ws8ti8lYcBm80+ pnVlSqpFNYJZM/UX4AZl1KeFwwtgpoLVj5M+8ZmWH1+tV/gLfNIsvML5IJOft7tw fStHS7MK3c3V8qA8gWahc+Xut9GeiJGnWOPYrQwjysCbTylkypyhS4nNGgHQzdUy r6MAYR4qQSjS3ZsH+joqiBfmTmPOVuNKUK7oI/QArLRnDhBPUNOUCL9glJ2cLCxh fw414l60rtOJNcFJAY4sJVQh2P/2o7At916DJ9OZ5A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvggtohdrtg homhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphhtthhopegvshgthhifrghrth iisehgvghnthhoohdrohhrghdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdef sehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:49 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 0ac0ba0a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:47 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:48 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 14/24] Makefile: refactor GIT-VERSION-GEN to be reusable Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Our "GIT-VERSION-GEN" script always writes the "GIT-VERSION-FILE" into the current directory, where the expectation is that it should exist in the source directory. But other build systems that support out-of-tree builds may not want to do that to keep the source directory pristine, even though CMake currently doesn't care. Refactor the script such that it doesn't write output to a file anymore but so that it instead writes the version to stdout. This makes it easier to compute the same version as our Makefile would without having to write the "GIT-VERSION-FILE". We should ideally refactor our CMake build instructions to stop writing into the source directory. But this step is out of scope of the current patch series. Signed-off-by: Patrick Steinhardt --- GIT-VERSION-GEN | 12 +----------- Makefile | 3 ++- contrib/buildsystems/CMakeLists.txt | 5 ++++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index b3265f7becb..f2c0f47786b 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,6 +1,5 @@ #!/bin/sh -GVF=GIT-VERSION-FILE DEF_VER=v2.47.0 LF=' @@ -28,13 +27,4 @@ fi VN=$(expr "$VN" : v*'\(.*\)') -if test -r $GVF -then - VC=$(sed -e 's/^GIT_VERSION = //' <$GVF) -else - VC=unset -fi -test "$VN" = "$VC" || { - echo >&2 "GIT_VERSION = $VN" - echo "GIT_VERSION = $VN" >$GVF -} +echo "$VN" diff --git a/Makefile b/Makefile index 50fbc4f29d0..cd28f88e1b3 100644 --- a/Makefile +++ b/Makefile @@ -592,7 +592,8 @@ include shared.mak # Disable -pedantic compilation. GIT-VERSION-FILE: FORCE - @$(SHELL_PATH) ./GIT-VERSION-GEN + @printf "GIT_VERSION = %s\n" $$($(SHELL_PATH) GIT-VERSION-GEN) >$@+ + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else cat $@+ >&2 && mv $@+ $@; fi -include GIT-VERSION-FILE # Set our default configuration. diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 1384c0eb6d3..21d6bce26c7 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -87,7 +87,10 @@ endif() if(NOT EXISTS ${CMAKE_SOURCE_DIR}/GIT-VERSION-FILE) message("Generating GIT-VERSION-FILE") execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/GIT-VERSION-GEN - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "GIT_VERSION = '${GIT_VERSION}'\n") endif() #Parse GIT-VERSION-FILE to get the version From patchwork Wed Oct 9 14:56:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828581 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1D421DF730 for ; Wed, 9 Oct 2024 14:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485816; cv=none; b=Y6DKEArWXmCN61jn1I1jkUJ1O5UqtA+GdAmO34/6XrvY9aBdd4+zacFbo8C9zRvAt9b3HmTgrMpA5BTUt8diP3u3v0KEruQq9qy/ZnwISs+WOOXQulML9V16VvccLWmcUablK2BA2yk5ESkCW/CnZR6UXYsrNCunAdi05+U6eOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485816; c=relaxed/simple; bh=SccM7wx0WnBJFIwkTMNFkPtdsI/iO7mPhqZcdufyK78=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=htzD+CMNgWtQTh9sgpYEv9Mrqj1d9sOx5RmPENq/e2WQOjTH49tVpM794uaUFon5AHuouGd0+IYHeTUxu+4JXEKJ18Fo2Gd2Ic+KhVeILgxdb4bEp08fp6mlQJAvfuIMgXx0ORETm0mlz4ExmY82zTmNGgR3NnCGHo3DnMhn7aY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=DmTLxpFw; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=PYsfcZDi; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="DmTLxpFw"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="PYsfcZDi" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id D116B13801BD; Wed, 9 Oct 2024 10:56:53 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 09 Oct 2024 10:56:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485813; x=1728572213; bh=299VxPpkE9 JMx5kPGt38rx7Pp0ANf7pBLEI6RlE8EP4=; b=DmTLxpFw8o6is9xA5JGnB/Wv7e USkJhmWSv6sGCsIaIPNxHt/FSWa3tz2QXcaWda/8dPW2IkCT51/i7zTSFVyNyXmm q9T5ytgmNd04ODZPcXcgPmYEWrrcuuECJNUIRKISgNU7PocqMgAwHzkHdI9OMyjZ 1+ZYmXlxw0OvKFupFcAwuDz59GNKuITNT42ypnSBHI+ew56d4StUZ1yCfcAwMKgY J2vFNWW3q1vwQhgGf/jorrQi0H20VYxUo7tz3mz35REh72e6U82t5xf2ZUDHWe9A ejudxoknBvxqNt7mrdVI1J80aT2hlzg6gqM4cRGzflK41SOlR6+PNyszn3Ug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485813; x=1728572213; bh=299VxPpkE9JMx5kPGt38rx7Pp0AN f7pBLEI6RlE8EP4=; b=PYsfcZDiQhk2hcaufo482w1yNbhMynX8DdfE1dx63Jbv LbXkbr7UhbQrRzGQW19xExnS+5mNjnn4dpzpPMb7sm+G9FpIU3+4mCBTxyTKbyVi uNOgHnqh3KY4kv9KP2xEXv9ztb/mH7e56Pl7co8jSQ/LJY56eUu148H10cUhl9dL q1NBExOrsZGwsbu6mjSM4OTqU4JR0dnSKNHRqGS5uDSr5WoYE4s4HgSaZxIjOQpk KyLAhfEzWJf6tMBbsfEQxBKDPzEt/Xc9eajpFHlD89hGUf4cXyramLB+JKhulknF pJTbVp1IcdkMPiYCZQVBRZCaRC4IpJPNrNjf2KOeZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepvghstghhfigrrhhtiiesghgvnhhtohhordhorhhgpd hrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehp hhhilhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthhtohepghhith hsthgvrhesphhosghogidrtghomhdprhgtphhtthhopehsuhhnshhhihhnvgesshhunhhs hhhinhgvtghordgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:52 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 581a9f15 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:49 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:51 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 15/24] Makefile: refactor generators to be PWD-independent Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: We have multiple scripts that generate headers from other data. All of these scripts have the assumption built-in that they are executed in the current source directory, which makes them a bit unwieldy to use during out-of-tree builds. This makes them a bit unwieldy to use. Refactor them to instead take the source directory as well as the output file as arguments. Signed-off-by: Patrick Steinhardt --- Makefile | 6 ++--- contrib/buildsystems/CMakeLists.txt | 12 +++------ generate-cmdlist.sh | 42 ++++++++++++++++++----------- generate-configlist.sh | 20 ++++++++++---- generate-hooklist.sh | 15 ++++++++++- 5 files changed, 61 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index cd28f88e1b3..0a7d07c9dfb 100644 --- a/Makefile +++ b/Makefile @@ -2523,17 +2523,17 @@ $(BUILT_INS): git$X config-list.h: generate-configlist.sh config-list.h: Documentation/*config.txt Documentation/config/*.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-configlist.sh . $@ command-list.h: generate-cmdlist.sh command-list.txt command-list.h: $(wildcard Documentation/git*.txt) $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh \ $(patsubst %,--exclude-program %,$(EXCLUDED_PROGRAMS)) \ - command-list.txt >$@ + . $@ hook-list.h: generate-hooklist.sh Documentation/githooks.txt - $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh >$@ + $(QUIET_GEN)$(SHELL_PATH) ./generate-hooklist.sh . $@ SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):\ $(localedir_SQ):$(USE_GETTEXT_SCHEME):$(SANE_TOOL_PATH_SQ):\ diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 21d6bce26c7..330a3f3504a 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -655,23 +655,17 @@ set(EXCLUSION_PROGS_CACHE ${EXCLUSION_PROGS} CACHE STRING "Programs not built" F if(NOT EXISTS ${CMAKE_BINARY_DIR}/command-list.h OR NOT EXCLUSION_PROGS_CACHE STREQUAL EXCLUSION_PROGS) list(REMOVE_ITEM EXCLUSION_PROGS empty) message("Generating command-list.h") - execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} command-list.txt - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/command-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-cmdlist.sh ${EXCLUSION_PROGS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/command-list.h) endif() if(NOT EXISTS ${CMAKE_BINARY_DIR}/config-list.h) message("Generating config-list.h") - execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-configlist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/config.list) endif() if(NOT EXISTS ${CMAKE_BINARY_DIR}/hook-list.h) message("Generating hook-list.h") - execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_FILE ${CMAKE_BINARY_DIR}/hook-list.h) + execute_process(COMMAND ${SH_EXE} ${CMAKE_SOURCE_DIR}/generate-hooklist.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/hook-list.h) endif() include_directories(${CMAKE_BINARY_DIR}) diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 205541e0f7f..b923a5aab80 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -64,7 +64,7 @@ define_category_names () { print_command_list () { echo "static struct cmdname_help command_list[] = {" - echo "$1" | + echo "$2" | while read cmd rest do synopsis= @@ -76,7 +76,7 @@ print_command_list () { break ;; esac - done <"Documentation/$cmd.txt" + done <"$1/Documentation/$cmd.txt" printf '\t{ "%s", N_("%s"), 0' "$cmd" "$synopsis" printf " | CAT_%s" $rest @@ -93,18 +93,28 @@ do shift done -commands="$(command_list "$1")" -categories="$(category_list "$commands")" +if test "$#" -ne 2 +then + die "USAGE: $0 " +fi + +SOURCE_DIR="$1" +OUTPUT="$2" + +{ + commands="$(command_list "$SOURCE_DIR"/command-list.txt)" + categories="$(category_list "$commands")" -echo "/* Automatically generated by generate-cmdlist.sh */ -struct cmdname_help { - const char *name; - const char *help; - uint32_t category; -}; -" -define_categories "$categories" -echo -define_category_names "$categories" -echo -print_command_list "$commands" + echo "/* Automatically generated by generate-cmdlist.sh */ + struct cmdname_help { + const char *name; + const char *help; + uint32_t category; + }; + " + define_categories "$categories" + echo + define_category_names "$categories" + echo + print_command_list "$SOURCE_DIR" "$commands" +} >"$OUTPUT" diff --git a/generate-configlist.sh b/generate-configlist.sh index 8692fe5cf4d..512804a1ca1 100755 --- a/generate-configlist.sh +++ b/generate-configlist.sh @@ -1,13 +1,19 @@ #!/bin/sh -echo "/* Automatically generated by generate-configlist.sh */" -echo +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo "USAGE: $0 " >&2 + exit 1 +fi print_config_list () { cat <"$OUTPUT" diff --git a/generate-hooklist.sh b/generate-hooklist.sh index 2f9f54eb545..0ff2a0b6fbd 100755 --- a/generate-hooklist.sh +++ b/generate-hooklist.sh @@ -2,6 +2,17 @@ # # Usage: ./generate-hooklist.sh >hook-list.h +SOURCE_DIR="$1" +OUTPUT="$2" + +if test -z "$SOURCE_DIR" || ! test -d "$SOURCE_DIR" || test -z "$OUTPUT" +then + echo "USAGE: $0 " >&2 + exit 1 +fi + +{ + cat <"$OUTPUT" From patchwork Wed Oct 9 14:56:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828582 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34FDC1DF734 for ; Wed, 9 Oct 2024 14:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485820; cv=none; b=VsYK2vDBsn8Fb5mnaIUlCNWLG+GRguavU/wDhagaSTEuLqgk7YQbmz5ncxBsAHLVOK/Q8l9d5Ds528Jhm6aRsY5lKJosrRZMGfJwt/c8IxMP0Ywyp8AWLu0Udny3IqAt2p6SQXsILWpOOH2sMi3MRsZMemwIbC6OIkqlqudF0iQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485820; c=relaxed/simple; bh=ShrlpK+XD8YvwPtPSQ/holIOKN6Kb6FGwu/JqRt8+Ls=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Iksrif1sY2yPijHb0nPDvoTWlB4L+oBfhIfzC1l5JhovSPjAeC+YA9o/vMz9jikEerP05NjIUUDV8Yd0IqRxEXr/6ULvPc6bftT4aUO0fLWsgygaYSVbVI/QxmgvVVBnBcbUbDH5l2ryRJ9jLC2Fcx0tY7HkYxd6YF39O6yTGks= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=i6AfgYID; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GIiBXXOx; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="i6AfgYID"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GIiBXXOx" Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id 505E313801AC; Wed, 9 Oct 2024 10:56:57 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Wed, 09 Oct 2024 10:56:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485817; x=1728572217; bh=VpU++EcMdz /kXQ28bmxMMl5WRg3rbCy5w1fyFvz/tFU=; b=i6AfgYID6Gnoum+VUsiKEFRg8w DrsSm+t5cHbC9wDNg1LbIXUP96DrWmPU5ggyM1A0QQ74OdWcIbKuUfpNW5BG6MNH /f6rbPrG4AHtP4LM47euxFpXy9GTcBbuMJBlaHiBtqXs8lu9h75HoLSgn5RG27+y trqM8R/rfv1RHGZ8bdIZKyrHvef1fbS8anHxOjU/WAzJDonV+jFd4RyLi2tqFl+R 9U31It/dBHQOGwsFPjLvhLndbzbW4ZFwo5DyZskisc21daaNE0esi3OhD+GOg6Ka 6HMDzqG066xKa+uEH8VT4sFnYw3kG5f5EoLpVtb5+1ghfW9U115zGvcFtlPA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485817; x=1728572217; bh=VpU++EcMdz/kXQ28bmxMMl5WRg3r bCy5w1fyFvz/tFU=; b=GIiBXXOxX4sXO8qabHhN58hBm6cTww5/3vT7KZywYzcH ZxDBUIcLBrNRwYLAuZoFA84csbBLJmnGlka3/uOj3mw8B/7eKnSfUq6ZA0nMLfiM 5nB/YX6hjjqbiUcKbHnv22csQ9294lVtqIedTAjOMS3vLQyXQ9/Lsci3n8FB4zWB oe6LF2LjngZahW/dznUzoQPhRajzSORKZibvOerlqhXPrt1690vTwyjMWGofKdg8 rA6s7AbONcMRDtGJ79rki5uHQnSjzR7o86stPLNyCJQ5k9Hb4Mr7x50lrYfcTwNf nVPQRF+MZcnxwppL46R7xxWN6RGCoIDfncbJUjeEUw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvggtohdrtg homhdprhgtphhtthhopegvshgthhifrghrthiisehgvghnthhoohdrohhrghdprhgtphht thhopehgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepphhhihhllhhiph drfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopehgihhtsehvghgvrhdr khgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:55 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 9c4f2b7f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:52 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:54 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 16/24] Makefile: use common template for GIT-BUILD-OPTIONS Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The "GIT-BUILD-OPTIONS" file is generated by our build systems to propagate built-in features and paths to our tests. The generation is done ad-hoc, where both our Makefile and the CMake build instructions simply echo a bunch of strings into the file. This makes it very hard to figure out what variables are expected to exist and what format they have, and the written variables can easily get out of sync between build systems. Introduce a new "GIT-BUILD-OPTIONS.in" template to address this issue. This has multiple advantages: - It demonstrates which built options exist in the first place. - It can serve as a spot to document the build options. - Some build systems complain when not all variables could be substituted, alerting us of mismatches. Others don't, but if we forgot to substitute such variables we now have a bogus string that will likely cause our tests to fail, if they have any meaning in the first place. Backfill values that we didn't yet set in our CMake build instructions. While at it, remove the `SUPPORTS_SIMPLE_IPC` variable that we only set up in CMake as it isn't used anywhere. Note that this change requires us to move around the setup of TEST_OUTPUT_DIRECTORY in "test-lib.sh" such that it comes after sourcing the "GIT-BUILD-OPTIONS" file. This is the only instance I could find where we rely on ordering on variables. Signed-off-by: Patrick Steinhardt --- GIT-BUILD-OPTIONS.in | 36 ++++++++++ Makefile | 108 ++++++++++------------------ contrib/buildsystems/CMakeLists.txt | 58 ++++++++++----- t/test-lib.sh | 13 ++-- 4 files changed, 120 insertions(+), 95 deletions(-) create mode 100644 GIT-BUILD-OPTIONS.in diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in new file mode 100644 index 00000000000..f0ca240493c --- /dev/null +++ b/GIT-BUILD-OPTIONS.in @@ -0,0 +1,36 @@ +SHELL_PATH=@SHELL_PATH@ +TEST_SHELL_PATH=@TEST_SHELL_PATH@ +PERL_PATH=@PERL_PATH@ +DIFF=@DIFF@ +PYTHON_PATH=@PYTHON_PATH@ +TAR=@TAR@ +NO_CURL=@NO_CURL@ +NO_ICONV=@NO_ICONV@ +NO_EXPAT=@NO_EXPAT@ +USE_LIBPCRE2=@USE_LIBPCRE2@ +NO_PERL=@NO_PERL@ +NO_PTHREADS=@NO_PTHREADS@ +NO_PYTHON=@NO_PYTHON@ +NO_REGEX=@NO_REGEX@ +NO_UNIX_SOCKETS=@NO_UNIX_SOCKETS@ +PAGER_ENV=@PAGER_ENV@ +SANITIZE_LEAK=@SANITIZE_LEAK@ +SANITIZE_ADDRESS=@SANITIZE_ADDRESS@ +X=@X@ +FSMONITOR_DAEMON_BACKEND=@FSMONITOR_DAEMON_BACKEND@ +FSMONITOR_OS_SETTINGS=@FSMONITOR_OS_SETTINGS@ +TEST_OUTPUT_DIRECTORY=@TEST_OUTPUT_DIRECTORY@ +GIT_TEST_OPTS=@GIT_TEST_OPTS@ +GIT_TEST_CMP=@GIT_TEST_CMP@ +GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@ +GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@ +NO_GETTEXT=@NO_GETTEXT@ +GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@ +GIT_PERF_REPO=@GIT_PERF_REPO@ +GIT_PERF_LARGE_REPO=@GIT_PERF_LARGE_REPO@ +GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@ +GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@ +GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ +GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ +GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ +RUNTIME_PREFIX=@RUNTIME_PREFIX@ diff --git a/Makefile b/Makefile index 0a7d07c9dfb..3079822da40 100644 --- a/Makefile +++ b/Makefile @@ -3158,76 +3158,44 @@ GIT-LDFLAGS: FORCE # that runs GIT-BUILD-OPTIONS, and then again to protect it # and the first level quoting from the shell that runs "echo". GIT-BUILD-OPTIONS: FORCE - @echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@+ - @echo TEST_SHELL_PATH=\''$(subst ','\'',$(TEST_SHELL_PATH_SQ))'\' >>$@+ - @echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@+ - @echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@+ - @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+ - @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+ - @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+ - @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+ - @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+ - @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+ - @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+ - @echo NO_PTHREADS=\''$(subst ','\'',$(subst ','\'',$(NO_PTHREADS)))'\' >>$@+ - @echo NO_PYTHON=\''$(subst ','\'',$(subst ','\'',$(NO_PYTHON)))'\' >>$@+ - @echo NO_REGEX=\''$(subst ','\'',$(subst ','\'',$(NO_REGEX)))'\' >>$@+ - @echo NO_UNIX_SOCKETS=\''$(subst ','\'',$(subst ','\'',$(NO_UNIX_SOCKETS)))'\' >>$@+ - @echo PAGER_ENV=\''$(subst ','\'',$(subst ','\'',$(PAGER_ENV)))'\' >>$@+ - @echo SANITIZE_LEAK=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_LEAK)))'\' >>$@+ - @echo SANITIZE_ADDRESS=\''$(subst ','\'',$(subst ','\'',$(SANITIZE_ADDRESS)))'\' >>$@+ - @echo X=\'$(X)\' >>$@+ -ifdef FSMONITOR_DAEMON_BACKEND - @echo FSMONITOR_DAEMON_BACKEND=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_DAEMON_BACKEND)))'\' >>$@+ -endif -ifdef FSMONITOR_OS_SETTINGS - @echo FSMONITOR_OS_SETTINGS=\''$(subst ','\'',$(subst ','\'',$(FSMONITOR_OS_SETTINGS)))'\' >>$@+ -endif -ifdef TEST_OUTPUT_DIRECTORY - @echo TEST_OUTPUT_DIRECTORY=\''$(subst ','\'',$(subst ','\'',$(TEST_OUTPUT_DIRECTORY)))'\' >>$@+ -endif -ifdef GIT_TEST_OPTS - @echo GIT_TEST_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_OPTS)))'\' >>$@+ -endif -ifdef GIT_TEST_CMP - @echo GIT_TEST_CMP=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_CMP)))'\' >>$@+ -endif -ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT - @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@+ -endif -ifdef GIT_TEST_UTF8_LOCALE - @echo GIT_TEST_UTF8_LOCALE=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_UTF8_LOCALE)))'\' >>$@+ -endif - @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@+ -ifdef GIT_PERF_REPEAT_COUNT - @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@+ -endif -ifdef GIT_PERF_REPO - @echo GIT_PERF_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPO)))'\' >>$@+ -endif -ifdef GIT_PERF_LARGE_REPO - @echo GIT_PERF_LARGE_REPO=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_LARGE_REPO)))'\' >>$@+ -endif -ifdef GIT_PERF_MAKE_OPTS - @echo GIT_PERF_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_OPTS)))'\' >>$@+ -endif -ifdef GIT_PERF_MAKE_COMMAND - @echo GIT_PERF_MAKE_COMMAND=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_MAKE_COMMAND)))'\' >>$@+ -endif -ifdef GIT_INTEROP_MAKE_OPTS - @echo GIT_INTEROP_MAKE_OPTS=\''$(subst ','\'',$(subst ','\'',$(GIT_INTEROP_MAKE_OPTS)))'\' >>$@+ -endif -ifdef GIT_TEST_INDEX_VERSION - @echo GIT_TEST_INDEX_VERSION=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_INDEX_VERSION)))'\' >>$@+ -endif -ifdef GIT_TEST_PERL_FATAL_WARNINGS - @echo GIT_TEST_PERL_FATAL_WARNINGS=\''$(subst ','\'',$(subst ','\'',$(GIT_TEST_PERL_FATAL_WARNINGS)))'\' >>$@+ -endif -ifdef RUNTIME_PREFIX - @echo RUNTIME_PREFIX=\'true\' >>$@+ -else - @echo RUNTIME_PREFIX=\'false\' >>$@+ -endif + @sed \ + -e "s|@SHELL_PATH@|\'$(SHELL_PATH_SQ)\'|" \ + -e "s|@TEST_SHELL_PATH@|\'$(TEST_SHELL_PATH_SQ)\'|" \ + -e "s|@PERL_PATH@|\'$(PERL_PATH_SQ)\'|" \ + -e "s|@DIFF@|\'$(DIFF)\'|" \ + -e "s|@PYTHON_PATH@|\'$(PYTHON_PATH_SQ)\'|" \ + -e "s|@TAR@|\'$(TAR)\'|" \ + -e "s|@NO_CURL@|\'$(NO_CURL)\'|" \ + -e "s|@NO_ICONV@|\'$(NO_ICONV)\'|" \ + -e "s|@NO_EXPAT@|\'$(NO_EXPAT)\'|" \ + -e "s|@USE_LIBPCRE2@|\'$(USE_LIBPCRE2)\'|" \ + -e "s|@NO_PERL@|\'$(NO_PERL)\'|" \ + -e "s|@NO_PTHREADS@|\'$(NO_PTHREADS)\'|" \ + -e "s|@NO_PYTHON@|\'$(NO_PYTHON)\'|" \ + -e "s|@NO_REGEX@|\'$(NO_REGEX)\'|" \ + -e "s|@NO_UNIX_SOCKETS@|\'$(NO_UNIX_SOCKETS)\'|" \ + -e "s|@PAGER_ENV@|\'$(PAGER_ENV)\'|" \ + -e "s|@SANITIZE_LEAK@|\'$(SANITIZE_LEAK)\'|" \ + -e "s|@SANITIZE_ADDRESS@|\'$(SANITIZE_ADDRESS)\'|" \ + -e "s|@X@|\'$(X)\'|" \ + -e "s|@FSMONITOR_DAEMON_BACKEND@|\'$(FSMONITOR_DAEMON_BACKEND)\'|" \ + -e "s|@FSMONITOR_OS_SETTINGS@|\'$(FSMONITOR_OS_SETTINGS)\'|" \ + -e "s|@TEST_OUTPUT_DIRECTORY@|\'$(TEST_OUTPUT_DIRECTORY)\'|" \ + -e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \ + -e "s|@GIT_TEST_CMP@|\'$(GIT_TEST_CMP)\'|" \ + -e "s|@GIT_TEST_CMP_USE_COPIED_CONTEXT@|\'$(GIT_TEST_CMP_USE_COPIED_CONTEXT)\'|" \ + -e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \ + -e "s|@NO_GETTEXT@|\'$(NO_GETTEXT)\'|" \ + -e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \ + -e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \ + -e "s|@GIT_PERF_LARGE_REPO@|\'$(GIT_PERF_LARGE_REPO)\'|" \ + -e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \ + -e "s|@GIT_PERF_MAKE_COMMAND@|\'$(GIT_PERF_MAKE_COMMAND)\'|" \ + -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \ + -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \ + -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \ + -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \ + GIT-BUILD-OPTIONS.in >$@+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi @if test -f GIT-BUILD-DIR; then rm GIT-BUILD-DIR; fi diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 330a3f3504a..842879976a2 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1140,27 +1140,47 @@ if(NOT PYTHON_TESTS) set(NO_PYTHON 1) endif() -file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SHELL_PATH='${SHELL_PATH}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TEST_SHELL_PATH='${TEST_SHELL_PATH}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PERL_PATH='${PERL_PATH}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_UNIX_SOCKETS='${NO_UNIX_SOCKETS}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PAGER_ENV='${PAGER_ENV}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "X='${EXE_EXTENSION}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_GETTEXT='${NO_GETTEXT}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "RUNTIME_PREFIX='${RUNTIME_PREFIX}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PYTHON='${NO_PYTHON}'\n") -file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "SUPPORTS_SIMPLE_IPC='${SUPPORTS_SIMPLE_IPC}'\n") +file(STRINGS ${CMAKE_SOURCE_DIR}/GIT-BUILD-OPTIONS.in git_build_options NEWLINE_CONSUME) +string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" git_build_options "${git_build_options}") +string(REPLACE "@TEST_SHELL_PATH@" "${TEST_SHELL_PATH}" git_build_options "${git_build_options}") +string(REPLACE "@PERL_PATH@" "${PERL_PATH}" git_build_options "${git_build_options}") +string(REPLACE "@DIFF@" "${DIFF}" git_build_options "${git_build_options}") +string(REPLACE "@PYTHON_PATH@" "${PYTHON_PATH}" git_build_options "${git_build_options}") +string(REPLACE "@TAR@" "${TAR}" git_build_options "${git_build_options}") +string(REPLACE "@NO_CURL@" "${NO_CURL}" git_build_options "${git_build_options}") +string(REPLACE "@NO_ICONV@" "${NO_ICONV}" git_build_options "${git_build_options}") +string(REPLACE "@NO_EXPAT@" "${NO_EXPAT}" git_build_options "${git_build_options}") +string(REPLACE "@USE_LIBPCRE2@" "" git_build_options "${git_build_options}") +string(REPLACE "@NO_PERL@" "${NO_PERL}" git_build_options "${git_build_options}") +string(REPLACE "@NO_PTHREADS@" "${NO_PTHREADS}" git_build_options "${git_build_options}") +string(REPLACE "@NO_PYTHON@" "${NO_PYTHON}" git_build_options "${git_build_options}") +string(REPLACE "@NO_REGEX@" "" git_build_options "${git_build_options}") +string(REPLACE "@NO_UNIX_SOCKETS@" "${NO_UNIX_SOCKETS}" git_build_options "${git_build_options}") +string(REPLACE "@PAGER_ENV@" "${PAGER_ENV}" git_build_options "${git_build_options}") +string(REPLACE "@SANITIZE_LEAK@" "" git_build_options "${git_build_options}") +string(REPLACE "@SANITIZE_ADDRESS@" "" git_build_options "${git_build_options}") +string(REPLACE "@X@" "${EXE_EXTENSION}" git_build_options "${git_build_options}") +string(REPLACE "@FSMONITOR_DAEMON_BACKEND@" "win32" git_build_options "${git_build_options}") +string(REPLACE "@FSMONITOR_OS_SETTINGS@" "win32" git_build_options "${git_build_options}") +string(REPLACE "@TEST_OUTPUT_DIRECTORY@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_CMP@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_CMP_USE_COPIED_CONTEXT@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}") +string(REPLACE "@NO_GETTEXT@" "${NO_GETTEXT}" git_build_options "${git_build_options}") +string(REPLACE "@GIT_PERF_REPEAT_COUNT@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_PERF_REPO@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_PERF_LARGE_REPO@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") +string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") if(USE_VCPKG) - file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") + string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") endif() +file(WRITE ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS ${git_build_options}) #Make the tests work when building out of the source tree get_filename_component(CACHE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../CMakeCache.txt ABSOLUTE) diff --git a/t/test-lib.sh b/t/test-lib.sh index a278181a056..4dd641baefe 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -35,12 +35,6 @@ else # needing to exist. TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 fi -if test -z "$TEST_OUTPUT_DIRECTORY" -then - # Similarly, override this to store the test-results subdir - # elsewhere - TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY -fi GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then @@ -100,6 +94,13 @@ fi . "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS export PERL_PATH SHELL_PATH +if test -z "$TEST_OUTPUT_DIRECTORY" +then + # Similarly, override this to store the test-results subdir + # elsewhere + TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY +fi + # In t0000, we need to override test directories of nested testcases. In case # the developer has TEST_OUTPUT_DIRECTORY part of his build options, then we'd # reset this value to instead contain what the developer has specified. We thus From patchwork Wed Oct 9 14:56:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828583 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75AA51A2647 for ; Wed, 9 Oct 2024 14:57:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485824; cv=none; b=Md1KK+gqyR5oXDmTaDVkWdDjw3Ba+JEQHecxuMJZR7AVnuQrUdq+Zs69hY08SPUSKxhRejrRPb/4ROFRHNptM4K/3CUOQ8/NXNYYwikFDlbgJTiEY/0oUOejKZtrpYgGHu5WBwrt0s3RbJ1IUs0Vi7fN8j7QSWIRHqDSjso+69U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485824; c=relaxed/simple; bh=agvd/Vht7bZHUVg6TXgahk1YBUOtwrx81RGq0cj5UIA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g00wlt/Xi/jooEsRcUK2Hxz3iw0UE4SXuBLLpCZpt05dP0RM6YqYynIkyg2fQeySVC4wBEwv+1lM2dTN0bmhIT3hZL6MrPZCUPwOjAvPqGmBwGPGrQI36Lm9rnQfmLdm+l2QpZP46vjwAgkXjMi61SWt1/6vv1/RiKCim4CDm6Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=rnY0sVnL; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Efhiy/oM; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="rnY0sVnL"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Efhiy/oM" Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id AE80F114015D; Wed, 9 Oct 2024 10:56:59 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Wed, 09 Oct 2024 10:56:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485819; x=1728572219; bh=AWb9fgDk8g QRZYehUzOA5FSs7eJFUVWQLf7b90oe2zE=; b=rnY0sVnLZ7F4OQF3WcNSwi77D5 NmTds5weM8BfrqXyFiQXLd6s5O1cz6IJs9VlDx8q/0wgU1DrNv5dkxTfmvhoaIAd k93yecXIzY2YaI9g6AYtd2XFVd4Lmehyn/Wpnq0cf+L15KUGYDFI5jHKdIZDEEK1 l50K5GzN3ZM8v72mdTiw3OkwxCkgz1H00ys+n5de2BP73YH2SR2G9L3B9+6TRTKP wobt/vfi8ssVckGlY4bP9dZlTBQF7BqEGQqsS8Rp/Ru6pOFFZ7FRVuCXxHedVFPC jwVXZQcKKGc6sS8X3TwDU0X5GKi8WFoWESvwVbx3oZlGg/Drne0DnMruuy3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485819; x=1728572219; bh=AWb9fgDk8gQRZYehUzOA5FSs7eJF UVWQLf7b90oe2zE=; b=Efhiy/oMYDHgoNVLL2ib20S4X4P/fOG0Yo/N4qbiuaqm EyPQf66DKc2KL8CAdVWzENbTt0xUGCOIS/zmzLPFIEn9+w4B5PG9QMyWsDqhILEj TCO006VdpglJgXxbo7PGRze38nSYWeTyAO+vEBrx/L37rx+59K/VvhAObpLjCp48 s3QlY6nrJ+5eAVGLV1ja5bTzEYaikIOboDW3Ig68fNBvHf9Ir+LwQm2rqj48dCyq sFhyibYP4mI2GUenhCJTqQGXMW9tWj1o0u1ciH50CoOceFkRFqfjOaVL57JCLSu6 BP0faQmtwe8RFWahI0ZvnqtYI/l13SS54t0eTiL5qQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepteduueeiheduhffhgeekhffhhfekueeltdevuddtkedv jefhheeutdduheeghfdvnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghdprghnughrvg dqshhimhhonhdruggvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehsmh htphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtphht thhopehphhhilhhlihhprdifohhougduvdefsehgmhgrihhlrdgtohhmpdhrtghpthhtoh epshhunhhshhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphhtthhopegvshgt hhifrghrthiisehgvghnthhoohdrohhrghdprhgtphhtthhopehgihhtsehvghgvrhdrkh gvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:56:58 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id f834d2a2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:55 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:57 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 17/24] Makefile: consistently use @PLACEHOLDER@ to substitute Message-ID: <97b9789dd6877717befd565fac896996f22a2268.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: We have a bunch of placeholders in our scripts that we replace at build time, for example by using sed(1). These placeholders come in three different formats: @PLACEHOLDER@, @@PLACEHOLDER@@ and ++PLACEHOLDER++. Next to being inconsistent it also creates a bit of a problem with CMake, which only supports the first syntax in its `configure_file()` function. To work around that we instead manually replace placeholders via string operations, which is a hassle and removes safeguards that CMake has to verify that we didn't forget to replace any placeholders. Besides that, other build systems like Meson also support the CMake syntax. Unify our codebase to consistently use the syntax supported by such build systems. Signed-off-by: Patrick Steinhardt --- Makefile | 42 +++++++++--------- configure.ac | 2 +- contrib/buildsystems/CMakeLists.txt | 34 +++++++------- generate-perl.sh | 2 +- git-cvsserver.perl | 2 +- git-instaweb.sh | 8 ++-- git-request-pull.sh | 2 +- git-send-email.perl | 2 +- git-sh-i18n.sh | 6 +-- git-sh-setup.sh | 6 +-- git-svn.perl | 2 +- gitk-git/po/vi.po | 2 +- gitweb/Makefile | 44 +++++++++---------- gitweb/gitweb.perl | 44 +++++++++---------- perl/Git/I18N.pm | 6 +-- perl/Git/LoadCPAN.pm | 6 +-- .../header_templates/fixed_prefix.template.pl | 2 +- .../runtime_prefix.template.pl | 8 ++-- unimplemented.sh | 2 +- wrap-for-bin.sh | 18 ++++---- 20 files changed, 120 insertions(+), 120 deletions(-) diff --git a/Makefile b/Makefile index 3079822da40..9f710a7cba9 100644 --- a/Makefile +++ b/Makefile @@ -1556,10 +1556,10 @@ endif ifdef SANE_TOOL_PATH SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH)) -BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' +BROKEN_PATH_FIX = 's|^\# @BROKEN_PATH_FIX@$$|git_broken_path_fix "$(SANE_TOOL_PATH_SQ)"|' PATH := $(SANE_TOOL_PATH):${PATH} else -BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d' +BROKEN_PATH_FIX = '/^\# @BROKEN_PATH_FIX@$$/d' endif ifeq (,$(HOST_CPU)) @@ -2549,13 +2549,13 @@ GIT-SCRIPT-DEFINES: FORCE define cmd_munge_script sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@@DIFF@@|$(DIFF_SQ)|' \ - -e 's|@@LOCALEDIR@@|$(localedir_SQ)|g' \ - -e 's/@@USE_GETTEXT_SCHEME@@/$(USE_GETTEXT_SCHEME)/g' \ + -e 's|@DIFF@|$(DIFF_SQ)|' \ + -e 's|@LOCALEDIR@|$(localedir_SQ)|g' \ + -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ -e $(BROKEN_PATH_FIX) \ - -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \ - -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ - -e 's|@@PAGER_ENV@@|$(PAGER_ENV_SQ)|g' \ + -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ + -e 's|@PERL@|$(PERL_PATH_SQ)|g' \ + -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ $@.sh >$@+ endef @@ -2622,11 +2622,11 @@ GIT-PERL-HEADER: $(PERL_HEADER_TEMPLATE) GIT-PERL-DEFINES Makefile INSTLIBDIR='$(perllibdir_SQ)' && \ INSTLIBDIR_EXTRA='$(PERLLIB_EXTRA_SQ)' && \ INSTLIBDIR="$$INSTLIBDIR$${INSTLIBDIR_EXTRA:+:$$INSTLIBDIR_EXTRA}" && \ - sed -e 's=@@PATHSEP@@=$(pathsep)=g' \ - -e "s=@@INSTLIBDIR@@=$$INSTLIBDIR=g" \ - -e 's=@@PERLLIBDIR_REL@@=$(perllibdir_relative_SQ)=g' \ - -e 's=@@GITEXECDIR_REL@@=$(gitexecdir_relative_SQ)=g' \ - -e 's=@@LOCALEDIR_REL@@=$(localedir_relative_SQ)=g' \ + sed -e 's=@PATHSEP@=$(pathsep)=g' \ + -e "s=@INSTLIBDIR@=$$INSTLIBDIR=g" \ + -e 's=@PERLLIBDIR_REL@=$(perllibdir_relative_SQ)=g' \ + -e 's=@GITEXECDIR_REL@=$(gitexecdir_relative_SQ)=g' \ + -e 's=@LOCALEDIR_REL@=$(localedir_relative_SQ)=g' \ $< >$@+ && \ mv $@+ $@ @@ -2642,7 +2642,7 @@ else # NO_PERL $(SCRIPT_PERL_GEN) git-instaweb: % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PERL=$(NO_PERL)|g' \ + -e 's|@REASON@|NO_PERL=$(NO_PERL)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ @@ -2663,13 +2663,13 @@ else # NO_PYTHON $(SCRIPT_PYTHON_GEN): % : unimplemented.sh $(QUIET_GEN) \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@REASON@@|NO_PYTHON=$(NO_PYTHON)|g' \ + -e 's|@REASON@|NO_PYTHON=$(NO_PYTHON)|g' \ unimplemented.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ endif # NO_PYTHON -CONFIGURE_RECIPE = sed -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ +CONFIGURE_RECIPE = sed -e 's/@GIT_VERSION@/$(GIT_VERSION)/g' \ configure.ac >configure.ac+ && \ autoconf -o configure configure.ac+ && \ $(RM) configure.ac+ @@ -3098,9 +3098,9 @@ endif perl/build/lib/%.pm: perl/%.pm GIT-PERL-DEFINES $(call mkdir_p_parent_template) $(QUIET_GEN) \ - sed -e 's|@@LOCALEDIR@@|$(perl_localedir_SQ)|g' \ - -e 's|@@NO_GETTEXT@@|$(NO_GETTEXT_SQ)|g' \ - -e 's|@@NO_PERL_CPAN_FALLBACKS@@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ + sed -e 's|@LOCALEDIR@|$(perl_localedir_SQ)|g' \ + -e 's|@NO_GETTEXT@|$(NO_GETTEXT_SQ)|g' \ + -e 's|@NO_PERL_CPAN_FALLBACKS@|$(NO_PERL_CPAN_FALLBACKS_SQ)|g' \ < $< > $@ perl/build/man/man3/Git.3pm: perl/Git.pm @@ -3218,8 +3218,8 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR bin-wrappers/%: wrap-for-bin.sh $(call mkdir_p_parent_template) $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ - -e 's|@@BUILD_DIR@@|$(shell pwd)|' \ - -e 's|@@PROG@@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ + -e 's|@BUILD_DIR@|$(shell pwd)|' \ + -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ chmod +x $@ # GNU make supports exporting all variables by "export" without parameters. diff --git a/configure.ac b/configure.ac index d1a96da14eb..5923edc44aa 100644 --- a/configure.ac +++ b/configure.ac @@ -142,7 +142,7 @@ fi ## Configure body starts here. AC_PREREQ(2.59) -AC_INIT([git], [@@GIT_VERSION@@], [git@vger.kernel.org]) +AC_INIT([git], [@GIT_VERSION@], [git@vger.kernel.org]) AC_CONFIG_SRCDIR([git.c]) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 842879976a2..73008bf2d18 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -833,14 +833,14 @@ set(git_shell_scripts foreach(script ${git_shell_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.sh content NEWLINE_CONSUME) string(REPLACE "@SHELL_PATH@" "${SHELL_PATH}" content "${content}") - string(REPLACE "@@DIFF@@" "diff" content "${content}") + string(REPLACE "@DIFF@" "diff" content "${content}") string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") string(REPLACE "@GITWEBDIR@" "${GITWEBDIR}" content "${content}") - string(REPLACE "@@NO_CURL@@" "" content "${content}") - string(REPLACE "@@USE_GETTEXT_SCHEME@@" "" content "${content}") - string(REPLACE "# @@BROKEN_PATH_FIX@@" "" content "${content}") - string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}") - string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}") + string(REPLACE "@NO_CURL@" "" content "${content}") + string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") + string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") + string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}") + string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach() @@ -849,13 +849,13 @@ parse_makefile_for_scripts(git_perl_scripts "SCRIPT_PERL" ".perl") #create perl header file(STRINGS ${CMAKE_SOURCE_DIR}/perl/header_templates/fixed_prefix.template.pl perl_header ) -string(REPLACE "@@PATHSEP@@" ":" perl_header "${perl_header}") -string(REPLACE "@@INSTLIBDIR@@" "${INSTLIBDIR}" perl_header "${perl_header}") +string(REPLACE "@PATHSEP@" ":" perl_header "${perl_header}") +string(REPLACE "@INSTLIBDIR@" "${INSTLIBDIR}" perl_header "${perl_header}") foreach(script ${git_perl_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/${script}.perl content NEWLINE_CONSUME) string(REPLACE "#!/usr/bin/perl" "#!/usr/bin/perl\n${perl_header}\n" content "${content}") - string(REPLACE "@@GIT_VERSION@@" "${PROJECT_VERSION}" content "${content}") + string(REPLACE "@GIT_VERSION@" "${PROJECT_VERSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach() @@ -870,8 +870,8 @@ file(GLOB_RECURSE perl_modules "${CMAKE_SOURCE_DIR}/perl/*.pm") foreach(pm ${perl_modules}) string(REPLACE "${CMAKE_SOURCE_DIR}/perl/" "" file_path ${pm}) file(STRINGS ${pm} content NEWLINE_CONSUME) - string(REPLACE "@@LOCALEDIR@@" "${LOCALEDIR}" content "${content}") - string(REPLACE "@@NO_PERL_CPAN_FALLBACKS@@" "" content "${content}") + string(REPLACE "@LOCALEDIR@" "${LOCALEDIR}" content "${content}") + string(REPLACE "@NO_PERL_CPAN_FALLBACKS@" "" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/perl/build/lib/${file_path} ${content}) #test-lib.sh requires perl/build/lib to be the build directory of perl modules endforeach() @@ -1079,21 +1079,21 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") - string(REPLACE "@@PROG@@" "${script}${EXE_EXTENSION}" content "${content}") + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") + string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) - string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") - string(REPLACE "@@PROG@@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") + string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") + string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) -string(REPLACE "@@BUILD_DIR@@" "${CMAKE_BINARY_DIR}" content "${content}") -string(REPLACE "@@PROG@@" "git-cvsserver" content "${content}") +string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") +string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content}) #options for configuring test options diff --git a/generate-perl.sh b/generate-perl.sh index b9e04d6f42a..41d78da029b 100755 --- a/generate-perl.sh +++ b/generate-perl.sh @@ -17,6 +17,6 @@ sed -e '1{' \ -e " r $PERL_HEADER" \ -e ' G' \ -e '}' \ - -e "s/@@GIT_VERSION@@/$GIT_VERSION/g" \ + -e "s/@GIT_VERSION@/$GIT_VERSION/g" \ "$PERL_SCRIPT" >"$OUT" chmod a+x "$OUT" diff --git a/git-cvsserver.perl b/git-cvsserver.perl index 124f598bdc0..70ae7cb8e45 100755 --- a/git-cvsserver.perl +++ b/git-cvsserver.perl @@ -26,7 +26,7 @@ use File::Basename; use Getopt::Long qw(:config require_order no_ignore_case); -my $VERSION = '@@GIT_VERSION@@'; +my $VERSION = '@GIT_VERSION@'; my $log = GITCVS::log->new(); my $cfg; diff --git a/git-instaweb.sh b/git-instaweb.sh index 8dbe21d5887..c8efb1205a8 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -PERL='@@PERL@@' +PERL='@PERL@' OPTIONS_KEEPDASHDASH= OPTIONS_STUCKLONG= OPTIONS_SPEC="\ @@ -38,8 +38,8 @@ conf="$GIT_DIR/gitweb/httpd.conf" # if installed, it doesn't need further configuration (module_path) test -z "$httpd" && httpd='lighttpd -f' -# Default is @@GITWEBDIR@@ -test -z "$root" && root='@@GITWEBDIR@@' +# Default is @GITWEBDIR@ +test -z "$root" && root='@GITWEBDIR@' # any untaken local port will do... test -z "$port" && port=1234 @@ -716,7 +716,7 @@ EOF gitweb_conf() { cat > "$fqgitdir/gitweb/gitweb_config.perl" <compile() if $ENV{'MOD_PERL'}; } -our $version = "++GIT_VERSION++"; +our $version = "@GIT_VERSION@"; our ($my_url, $my_uri, $base_url, $path_info, $home_link); sub evaluate_uri { @@ -80,46 +80,46 @@ sub evaluate_uri { # core git executable to use # this can just be "git" if your webserver has a sensible PATH -our $GIT = "++GIT_BINDIR++/git"; +our $GIT = "@GIT_BINDIR@/git"; # absolute fs-path which will be prepended to the project path #our $projectroot = "/pub/scm"; -our $projectroot = "++GITWEB_PROJECTROOT++"; +our $projectroot = "@GITWEB_PROJECTROOT@"; # fs traversing limit for getting project list # the number is relative to the projectroot -our $project_maxdepth = "++GITWEB_PROJECT_MAXDEPTH++"; +our $project_maxdepth = "@GITWEB_PROJECT_MAXDEPTH@"; # string of the home link on top of all pages -our $home_link_str = "++GITWEB_HOME_LINK_STR++"; +our $home_link_str = "@GITWEB_HOME_LINK_STR@"; # extra breadcrumbs preceding the home link our @extra_breadcrumbs = (); # name of your site or organization to appear in page titles # replace this with something more descriptive for clearer bookmarks -our $site_name = "++GITWEB_SITENAME++" +our $site_name = "@GITWEB_SITENAME@" || ($ENV{'SERVER_NAME'} || "Untitled") . " Git"; # html snippet to include in the section of each page -our $site_html_head_string = "++GITWEB_SITE_HTML_HEAD_STRING++"; +our $site_html_head_string = "@GITWEB_SITE_HTML_HEAD_STRING@"; # filename of html text to include at top of each page -our $site_header = "++GITWEB_SITE_HEADER++"; +our $site_header = "@GITWEB_SITE_HEADER@"; # html text to include at home page -our $home_text = "++GITWEB_HOMETEXT++"; +our $home_text = "@GITWEB_HOMETEXT@"; # filename of html text to include at bottom of each page -our $site_footer = "++GITWEB_SITE_FOOTER++"; +our $site_footer = "@GITWEB_SITE_FOOTER@"; # URI of stylesheets -our @stylesheets = ("++GITWEB_CSS++"); +our @stylesheets = ("@GITWEB_CSS@"); # URI of a single stylesheet, which can be overridden in GITWEB_CONFIG. our $stylesheet = undef; # URI of GIT logo (72x27 size) -our $logo = "++GITWEB_LOGO++"; +our $logo = "@GITWEB_LOGO@"; # URI of GIT favicon, assumed to be image/png type -our $favicon = "++GITWEB_FAVICON++"; +our $favicon = "@GITWEB_FAVICON@"; # URI of gitweb.js (JavaScript code for gitweb) -our $javascript = "++GITWEB_JS++"; +our $javascript = "@GITWEB_JS@"; # URI and label (title) of GIT logo link #our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/"; @@ -128,7 +128,7 @@ sub evaluate_uri { our $logo_label = "git homepage"; # source of projects list -our $projects_list = "++GITWEB_LIST++"; +our $projects_list = "@GITWEB_LIST@"; # the width (in characters) of the projects list "Description" column our $projects_list_description_width = 25; @@ -147,7 +147,7 @@ sub evaluate_uri { # show repository only if this file exists # (only effective if this variable evaluates to true) -our $export_ok = "++GITWEB_EXPORT_OK++"; +our $export_ok = "@GITWEB_EXPORT_OK@"; # don't generate age column on the projects list page our $omit_age_column = 0; @@ -161,11 +161,11 @@ sub evaluate_uri { our $export_auth_hook = undef; # only allow viewing of repositories also shown on the overview page -our $strict_export = "++GITWEB_STRICT_EXPORT++"; +our $strict_export = "@GITWEB_STRICT_EXPORT@"; # list of git base URLs used for URL to where fetch project from, # i.e. full URL is "$git_base_url/$project" -our @git_base_url_list = grep { $_ ne '' } ("++GITWEB_BASE_URL++"); +our @git_base_url_list = grep { $_ ne '' } ("@GITWEB_BASE_URL@"); # default blob_plain mimetype and default charset for text/plain blob our $default_blob_plain_mimetype = 'text/plain'; @@ -200,7 +200,7 @@ sub evaluate_uri { # http://andre-simon.de/zip/download.php due to assumptions about parameters and output). # Useful if highlight is not installed on your webserver's PATH. # [Default: highlight] -our $highlight_bin = "++HIGHLIGHT_BIN++"; +our $highlight_bin = "@HIGHLIGHT_BIN@"; # information about snapshot formats that gitweb is capable of serving our %known_snapshot_formats = ( @@ -741,9 +741,9 @@ sub read_config_file { our ($GITWEB_CONFIG, $GITWEB_CONFIG_SYSTEM, $GITWEB_CONFIG_COMMON); sub evaluate_gitweb_config { - our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "++GITWEB_CONFIG++"; - our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++"; - our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++"; + our $GITWEB_CONFIG = $ENV{'GITWEB_CONFIG'} || "@GITWEB_CONFIG@"; + our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "@GITWEB_CONFIG_SYSTEM@"; + our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "@GITWEB_CONFIG_COMMON@"; # Protect against duplications of file names, to not read config twice. # Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so diff --git a/perl/Git/I18N.pm b/perl/Git/I18N.pm index 475e90a6df5..f8f0ca31254 100644 --- a/perl/Git/I18N.pm +++ b/perl/Git/I18N.pm @@ -20,14 +20,14 @@ BEGIN # this "'@@' [...] '@@'" pattern. use constant NO_GETTEXT_STR => '@@' . 'NO_GETTEXT' . '@@'; use constant NO_GETTEXT => ( - q[@@NO_GETTEXT@@] ne '' + q[@NO_GETTEXT@] ne '' and - q[@@NO_GETTEXT@@] ne NO_GETTEXT_STR + q[@NO_GETTEXT@] ne NO_GETTEXT_STR ); sub __bootstrap_locale_messages { our $TEXTDOMAIN = 'git'; - our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@@LOCALEDIR@@'; + our $TEXTDOMAINDIR ||= $ENV{GIT_TEXTDOMAINDIR} || '@LOCALEDIR@'; die "NO_GETTEXT=" . NO_GETTEXT_STR if NO_GETTEXT; require POSIX; diff --git a/perl/Git/LoadCPAN.pm b/perl/Git/LoadCPAN.pm index 8c7fa805f97..6be99840f84 100644 --- a/perl/Git/LoadCPAN.pm +++ b/perl/Git/LoadCPAN.pm @@ -31,11 +31,11 @@ =head1 DESCRIPTION # Makefile, and allows for detecting whether the module is loaded from # perl/Git as opposed to perl/build/Git, which is useful for one-off # testing without having Error.pm et al installed. -use constant NO_PERL_CPAN_FALLBACKS_STR => '@@' . 'NO_PERL_CPAN_FALLBACKS' . '@@'; +use constant NO_PERL_CPAN_FALLBACKS_STR => '@' . 'NO_PERL_CPAN_FALLBACKS' . '@'; use constant NO_PERL_CPAN_FALLBACKS => ( - q[@@NO_PERL_CPAN_FALLBACKS@@] ne '' + q[@NO_PERL_CPAN_FALLBACKS@] ne '' and - q[@@NO_PERL_CPAN_FALLBACKS@@] ne NO_PERL_CPAN_FALLBACKS_STR + q[@NO_PERL_CPAN_FALLBACKS@] ne NO_PERL_CPAN_FALLBACKS_STR ); sub import { diff --git a/perl/header_templates/fixed_prefix.template.pl b/perl/header_templates/fixed_prefix.template.pl index 857b4391a49..d571ca5cde5 100644 --- a/perl/header_templates/fixed_prefix.template.pl +++ b/perl/header_templates/fixed_prefix.template.pl @@ -1 +1 @@ -use lib (split(/@@PATHSEP@@/, $ENV{GITPERLLIB} || '@@INSTLIBDIR@@')); +use lib (split(/@PATHSEP@/, $ENV{GITPERLLIB} || '@INSTLIBDIR@')); diff --git a/perl/header_templates/runtime_prefix.template.pl b/perl/header_templates/runtime_prefix.template.pl index 9d28b3d8636..e6f8e661a16 100644 --- a/perl/header_templates/runtime_prefix.template.pl +++ b/perl/header_templates/runtime_prefix.template.pl @@ -3,7 +3,7 @@ # This finds our Git::* libraries relative to the script's runtime path. sub __git_system_path { my ($relpath) = @_; - my $gitexecdir_relative = '@@GITEXECDIR_REL@@'; + my $gitexecdir_relative = '@GITEXECDIR_REL@'; # GIT_EXEC_PATH is supplied by `git` or the test suite. my $exec_path; @@ -24,11 +24,11 @@ sub __git_system_path { } BEGIN { - use lib split /@@PATHSEP@@/, + use lib split /@PATHSEP@/, ( $ENV{GITPERLLIB} || do { - my $perllibdir = __git_system_path('@@PERLLIBDIR_REL@@'); + my $perllibdir = __git_system_path('@PERLLIBDIR_REL@'); (-e $perllibdir) || die("Invalid system path ($relpath): $path"); $perllibdir; } @@ -36,7 +36,7 @@ BEGIN # Export the system locale directory to the I18N module. The locale directory # is only installed if NO_GETTEXT is set. - $Git::I18N::TEXTDOMAINDIR = __git_system_path('@@LOCALEDIR_REL@@'); + $Git::I18N::TEXTDOMAINDIR = __git_system_path('@LOCALEDIR_REL@'); } # END RUNTIME_PREFIX generated code. diff --git a/unimplemented.sh b/unimplemented.sh index fee21d24e8a..41776b279d4 100644 --- a/unimplemented.sh +++ b/unimplemented.sh @@ -1,4 +1,4 @@ #!/bin/sh -echo >&2 "fatal: git was built without support for $(basename $0) (@@REASON@@)." +echo >&2 "fatal: git was built without support for $(basename $0) (@REASON@)." exit 128 diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh index 95851b85b6b..7898a1c238d 100644 --- a/wrap-for-bin.sh +++ b/wrap-for-bin.sh @@ -4,33 +4,33 @@ # to run test suite against sandbox, but with only bindir-installed # executables in PATH. The Makefile copies this into various # files in bin-wrappers, substituting -# @@BUILD_DIR@@ and @@PROG@@. +# @BUILD_DIR@ and @PROG@. -GIT_EXEC_PATH='@@BUILD_DIR@@' +GIT_EXEC_PATH='@BUILD_DIR@' if test -n "$NO_SET_GIT_TEMPLATE_DIR" then unset GIT_TEMPLATE_DIR else - GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt' + GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' export GIT_TEMPLATE_DIR fi -GITPERLLIB='@@BUILD_DIR@@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" -GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale' -PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH" +GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" +GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' +PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR case "$GIT_DEBUGGER" in '') - exec "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec "${GIT_EXEC_PATH}/@PROG@" "$@" ;; 1) unset GIT_DEBUGGER - exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec gdb --args "${GIT_EXEC_PATH}/@PROG@" "$@" ;; *) GIT_DEBUGGER_ARGS="$GIT_DEBUGGER" unset GIT_DEBUGGER - exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@" + exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@PROG@" "$@" ;; esac From patchwork Wed Oct 9 14:56:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828584 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07BCA1A2C25 for ; Wed, 9 Oct 2024 14:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485826; cv=none; b=ndr/PTVR6hWTGkdtkRZvJ3HaW5MyKssI781Kih0Fo14flw+ieADuS/EhTaOLuztgFZo5FIYAZGRuPO9QrNvojBsMvWrPRHMoUkzIF3Qkg/2A2AdSFPLxrFAg+4eZs2tXLWeG39xQZCdyVkCyDh32D7zuZ6KgrLZn6FEAOG1mUyM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485826; c=relaxed/simple; bh=0by8LkXDNgsPxRMG1PZOtkaW26TdmvmwdPE2yO8+wFU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y7U8sIerfQP3HEUZMeR0IQ+SXRwAHI5Y2KlcFW3o7Aazw6nrYTlgd0LfZTsbz8siZP4e4ObuDXrDgUzlymy2083xTgD6tBsVSiyezFhd171wpN1q9QUZlcJ2zVGsuZgDxZKj27CL7T8eAEdCNgTkPT+ue72JqtUP51jVzOPoeio= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=m0jRV2zn; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=a28HdvE/; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="m0jRV2zn"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="a28HdvE/" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 2521E13801C2; Wed, 9 Oct 2024 10:57:04 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 09 Oct 2024 10:57:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485824; x=1728572224; bh=ygP2rr4wb3 eQAKOQl5UybY5qjYpF/N/0aIERRXCYnTc=; b=m0jRV2znfAINqG87zTaWDK5jxf O+b0PuS2Gvl0dUWWj2YCBh2CkOvf3Ukp5GylwnYc7MvvvJBjbGe6UCTKZIJxeglE o6Wg4V/w5gV2RTjTgDE3mTZSVuGzkhYAzw2xcvBAz+eGX1DkST78TSfcUtt1/s5E UL/bV/03PRN1eKzO5cj0vs7lHgy+TQsO1T7lqtMnIhPPGw2TvAoquYuTm2Tu2fpj FYo7f6Gr/Z93NHiGu/ovZRpbcZs9OCYoMQOOA9tEoexPdADtCDik4toE4IxoFmWw Q2WOpR8maGXF0UXuQUJnwBNiqHJG2lFB0bCDD8EwE0zRoP1IeUEF1uaHFawQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485824; x=1728572224; bh=ygP2rr4wb3eQAKOQl5UybY5qjYpF /N/0aIERRXCYnTc=; b=a28HdvE/BR7dvPEtw+GjNlKci1ZN7hbqaXV+6x7CoPI9 40fx70zKf14TLuTsLjKGhzqVFJk2OZh8hr3vMVO340qZnD6qVAjZESjAC1JaOPNk BzTwsGl9uKfVlEZ5B289uZRpP7reko79lsDVpk3cf5mxAzuoM/8B8kaL//qhqVtV kWjZhFj5jtHAr/5Q6PjfGNwitzJjbomQ8nS8X6kbP5Nvrej2aL55eZXqd5RkTzoL o5baMfhl721TaUueu9JHDo3OPr/U6LS+u0yKKhnS/vmErlghnaUNL01Rc22lAz7M YN3GIUk+z671hfkA+X3P399J8GwrCd2X4meQ6KS//g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopegvshgthhifrghrthiisehgvghnthhoohdrohhrghdprhgtphhtthhopehsuhhn shhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthhtohepghhithesvhhgvg hrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdef sehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:02 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id de674e38 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:55:59 +0000 (UTC) Date: Wed, 9 Oct 2024 16:56:59 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 18/24] Makefile: consistently use PERL_PATH Message-ID: <1ee9c61fc33eb0da44f223ef5c86334f4d8e3666.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: When injecting the Perl path into our scripts we sometimes use '@PERL@' while we othertimes use '@PERL_PATH@'. Refactor the code use the latter consistently, which makes it easier to reuse the same logic for multiple scripts. Signed-off-by: Patrick Steinhardt --- Makefile | 2 +- contrib/buildsystems/CMakeLists.txt | 2 +- git-instaweb.sh | 4 ++-- git-request-pull.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 9f710a7cba9..46327596275 100644 --- a/Makefile +++ b/Makefile @@ -2554,7 +2554,7 @@ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's/@USE_GETTEXT_SCHEME@/$(USE_GETTEXT_SCHEME)/g' \ -e $(BROKEN_PATH_FIX) \ -e 's|@GITWEBDIR@|$(gitwebdir_SQ)|g' \ - -e 's|@PERL@|$(PERL_PATH_SQ)|g' \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' \ -e 's|@PAGER_ENV@|$(PAGER_ENV_SQ)|g' \ $@.sh >$@+ endef diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index 73008bf2d18..d63c9078345 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -839,7 +839,7 @@ foreach(script ${git_shell_scripts}) string(REPLACE "@NO_CURL@" "" content "${content}") string(REPLACE "@USE_GETTEXT_SCHEME@" "" content "${content}") string(REPLACE "# @BROKEN_PATH_FIX@" "" content "${content}") - string(REPLACE "@PERL@" "${PERL_PATH}" content "${content}") + string(REPLACE "@PERL_PATH@" "${PERL_PATH}" content "${content}") string(REPLACE "@PAGER_ENV@" "LESS=FRX LV=-c" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content}) endforeach() diff --git a/git-instaweb.sh b/git-instaweb.sh index c8efb1205a8..5ad50160bb0 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -PERL='@PERL@' +PERL='@PERL_PATH@' OPTIONS_KEEPDASHDASH= OPTIONS_STUCKLONG= OPTIONS_SPEC="\ @@ -716,7 +716,7 @@ EOF gitweb_conf() { cat > "$fqgitdir/gitweb/gitweb_config.perl" < X-Patchwork-Id: 13828585 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 692A51DFE00 for ; Wed, 9 Oct 2024 14:57:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485829; cv=none; b=fV7TYdwUKOApFcxQqEhvnHg0NeU2fdxXoIavDPNyTl6TA0OoQlAB1J5Xg/zj/rcCexnGHUyUO/WL8UJ0d2ZuCgOvn8C3U5PFFzywXOEojoI2LMacCOH4U4Os/aeIVZVXPcgJ7/3PoF5YTAX6roqHHfeIilH6qVKXXT4iCeKU72A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485829; c=relaxed/simple; bh=+jRGbOikhFlp1Obhs2pIF5uY9+6Olg6ULAuPE6+3lBU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tij3LULN7/DmICCF1IFiAbGZ+FWWSJ2FjuygBYkkvRraAgEaQHJ3Z0TsEm853kQkiRcK5dQtaPWVzGvevDOlnOQxWm8FR3EKGCLNdA93Nk68KyC2E+0UPB6MPMK1IFHOF7LBBSxr9y9Qtyu3bYSiTnMYICGHUEuU8PCie/wjIaM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=ASGG45pS; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=YttHEZp1; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="ASGG45pS"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="YttHEZp1" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 9E8C91140179; Wed, 9 Oct 2024 10:57:06 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 09 Oct 2024 10:57:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485826; x=1728572226; bh=sqQDqrTsrZ Wh1vS1neHzoERWFcXNo+fas8ffRvnEN+A=; b=ASGG45pSFmQwZmS1fkLm2l+43C gY4wcv0eknN8hPCgODa0SuI07SI7Mn11eNKNhStKbNXDbdMcjzJQoK5CbcsOzbIY lvtt4cC2kvAsJLTWG7QXMufuiTZW2vhRGRkTitX7WtTzPSMRUvqIxiF3ktQBkBjn PDDDosMa18MweKOTX/jbfB8jjqYzSFFIaJx7rXET5yoVeTiDRv93zYuntmNvwiwm jiW0xDFjc5spPSz/pn/aPSHEoQmYyYZEmnq9xnePN/U7+rjc/B9RGLgdudM9DnTl 0oA/woU7WO1/RZaNSlGAy+L2eLsZpX0EpbGk4stGz4EA25KmDfyTlpBHuJ3w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485826; x=1728572226; bh=sqQDqrTsrZWh1vS1neHzoERWFcXN o+fas8ffRvnEN+A=; b=YttHEZp1ahYhhc0EJTqGYOxGwnfry6cAH5IsT/XTR5HZ 7//VWPGnFAuhaIGWC9Mi/bqn4Ao4FgoTo9jNKTZ+lYKgpCpMTtQiPmvXV2uTah5J JLHOakVAJiUGTDWnxclyNAeyD1pE9g0E4Rbrr41SUWxMi2TWQNrXctrIdpdTmTt5 zqUU1v9R/5TCcoS75F/C3nFGZBeFyf70T80GSnLIjbtjsmvSuon2Jr5I65fbZZ+e o53hVsA6eAOmcKmE4p/eRzUbI2Yup54yhm48IKabNjlQRlXSD7OfM8ky530y11TZ 7eSaLfv0MuyNQzLIslnZ8j0B4BWy1CKs/K5+Fv0w1Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvggtohdrtg homhdprhgtphhtthhopehgihhtsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthht ohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhope hgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepvghstghhfigrrhhtiies ghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:05 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id bc5e03ec (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:56:02 +0000 (UTC) Date: Wed, 9 Oct 2024 16:57:04 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 19/24] Makefile: allow "bin-wrappers/" directory to exist Message-ID: <9fd1aeb1e967df5740687e1141859b8015646452.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The "bin-wrappers/" directory gets created by our build system and is populated with one script for each of our binaries. There isn't anything inherently wrong with the current layout, but it is somewhat hard to adapt for out-of-tree build systems. Adapt the layout such that our "bin-wrappers/" directory always exists and contains our "wrap-for-bin.sh" script to make things a little bit easier for subsequent steps. Signed-off-by: Patrick Steinhardt --- .gitignore | 1 - Documentation/CodingGuidelines | 2 +- Makefile | 6 +++--- bin-wrappers/.gitignore | 9 +++++++++ wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh | 0 contrib/buildsystems/CMakeLists.txt | 6 +++--- 6 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 bin-wrappers/.gitignore rename wrap-for-bin.sh => bin-wrappers/wrap-for-bin.sh (100%) mode change 100644 => 100755 diff --git a/.gitignore b/.gitignore index 6687bd6db4c..349673c55c9 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ /GIT-TEST-SUITES /GIT-USER-AGENT /GIT-VERSION-FILE -/bin-wrappers/ /git /git-add /git-am diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 3263245b032..ad831567444 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -583,7 +583,7 @@ For C programs: Run `GIT_DEBUGGER=1 ./bin-wrappers/git foo` to simply use gdb as is, or run `GIT_DEBUGGER=" " ./bin-wrappers/git foo` to use your own debugger and arguments. Example: `GIT_DEBUGGER="ddd --gdb" - ./bin-wrappers/git log` (See `wrap-for-bin.sh`.) + ./bin-wrappers/git log` (See `bin-wrappers/wrap-for-bin.sh`.) - The primary data structure that a subsystem 'S' deals with is called `struct S`. Functions that operate on `struct S` are named diff --git a/Makefile b/Makefile index 46327596275..554d8ea83b2 100644 --- a/Makefile +++ b/Makefile @@ -3215,8 +3215,7 @@ test_bindir_programs := $(patsubst %,bin-wrappers/%,$(BINDIR_PROGRAMS_NEED_X) $( all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PROG) -bin-wrappers/%: wrap-for-bin.sh - $(call mkdir_p_parent_template) +bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ @@ -3712,7 +3711,8 @@ clean: profile-clean coverage-clean cocciclean $(RM) $(FUZZ_PROGRAMS) $(RM) $(SP_OBJ) $(RM) $(HCC) - $(RM) -r bin-wrappers $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) -r $(dep_dirs) $(compdb_dir) compile_commands.json + $(RM) $(test_bindir_programs) $(RM) -r po/build/ $(RM) *.pyc *.pyo */*.pyc */*.pyo $(GENERATED_H) $(ETAGS_TARGET) tags cscope* $(RM) -r .dist-tmp-dir .doc-tmp-dir diff --git a/bin-wrappers/.gitignore b/bin-wrappers/.gitignore new file mode 100644 index 00000000000..1c6c90458b7 --- /dev/null +++ b/bin-wrappers/.gitignore @@ -0,0 +1,9 @@ +/git +/git-cvsserver +/git-receive-pack +/git-shell +/git-upload-archive +/git-upload-pack +/scalar +/test-fake-ssh +/test-tool diff --git a/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh old mode 100644 new mode 100755 similarity index 100% rename from wrap-for-bin.sh rename to bin-wrappers/wrap-for-bin.sh diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index d63c9078345..e32ce8ce8b7 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1078,20 +1078,20 @@ set(wrapper_test_scripts foreach(script ${wrapper_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() foreach(script ${wrapper_test_scripts}) - file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) + file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "t/helper/${script}${EXE_EXTENSION}" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/${script} ${content}) endforeach() -file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME) +file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content}) From patchwork Wed Oct 9 14:57:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828586 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB8611DFE22 for ; Wed, 9 Oct 2024 14:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485831; cv=none; b=Dh6FL5wmRo8i0mn9I3JOCy303ccL/Psgu77AUG0VnPSmpf58bERn7LPFLILWZuRdipKgO1eGG/0b58rF5DCi8THOiBZgD2Mp6K292qRe4zLsCJ0HW+QOvWymWiKHQPJKJjrqaNLcsqYad8sNLyC4GFuYCtGoas2L3nOMsO+5mzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485831; c=relaxed/simple; bh=8EZFjoTHF1RX+PLdRNUJfauggSt/AqTn9gxKJUUNXnI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HxVbDppi1j7jjWLHy9imR0gVgE7gLOg3C4cBZ98uzYh+/YT2WOqQe+w3cFZLOKDEwsmHiVn6QBgPOB+QY1ZRCQwlcTzWBW86vQS/oTO87Oy81s1Mhuk/yVmjM5QSmXNA8tNYVuCKD7s5TmDfd9B5tBmWzglIyv8gEJzNGOwUI6Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=RP8uGSNv; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=dk8heY2U; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="RP8uGSNv"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dk8heY2U" Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfhigh.phl.internal (Postfix) with ESMTP id 11DEC1140177; Wed, 9 Oct 2024 10:57:09 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Wed, 09 Oct 2024 10:57:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485829; x=1728572229; bh=WHvFjAGkni 03Np9KiVSMaa5ZGMj2/mSjQtAn/XARG6A=; b=RP8uGSNvwDQE8We0En2fFd47KV Uxx4kCaBzVcgfJCtAeMfVRjZaKuRJddZailJLP0w8J3T8G/6WjmHzDrvHLcOiyi0 kVIFPHjJ4TAb3IctnQffDOCyf7gmK6EFaGFh/WEXYWKlE0vx6P7oQc07bv+G+0QP ndbShauE/Dapc265EPdu4FtnN7wl1ZNT62IhyUYEuwE5gnJC9fuc5aizYLgld/7Y 3M+H2/jesRulud5WeLWK6axHBNbzIQckpzwusRyorNOfmVAGyu7BZ0NDfR6BM70P LPRPB+2M13TWRdqnPCoeldSAUSuXAM4f5XedWwD1zR1A2q0lqpQvUWn1fpag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485829; x=1728572229; bh=WHvFjAGkni03Np9KiVSMaa5ZGMj2 /mSjQtAn/XARG6A=; b=dk8heY2UpjNizUJLF48Qq1N5aFoouUvozG29bRSMPxZG G4WdCX3bg37Ps7MHeUvdf4ocD4z01C7QXBehDaUFmMVMS7EIYRWsdeByshDJfUGa dos1DyeGsg74dK/JZApja78U414QaBhegWAYf2pvwLdGzKcN0EaDG3JIlS6o4KOu 4BlFyUUxEwfWajAI406m6J4WEst7X/xefqqNSdRyfBq8E6yN1nhFFO5WPnELvtb3 loJ/3kUOH/LMO6M2wJiN/sm6d7DWaIkO+dfqsHZikQ/RIq8hUKSfsR/kHWzHPxgg f1XNmergmCR+lT+542ZL0+IVHtdJIis6mZz8Ad0vHw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehsuhhnshhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthht ohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhope hgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepvghstghhfigrrhhtiies ghgvnhhtohhordhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:07 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 554104fb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:56:05 +0000 (UTC) Date: Wed, 9 Oct 2024 16:57:06 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 20/24] Makefile: simplify building of templates Message-ID: <4eda54cf0f5a77152009e8fb9bde8dbea12a4e97.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: When we install Git we also install a set of default templates that both git-init(1) and git-clone(1) populate into our build directories. The way the pristine templates are layed out in our source directory is somewhat weird though: instead of reconstructing the actual directory hierarchy in "templates/", we represent directory separators with "--". The only reason I could come up with for why we have this is the "branches/" directory, which is supposed to be empty when installing it. And as Git famously doesn't store empty directories at all we have to work around this limitation. Now the thing is that the "branches/" directory is a leftover to how branches used to be stored in the dark ages. gitrepository-layout(5) lists this directory as "slightly deprecated", which I would claim is a strong understatement. I have never encountered anybody using it today and would be surprised if it even works as expected. So having the "--" hack in place for an item that is basically unused, unmaintained and deprecated doesn't only feel unreasonable, but installing that entry by default may also cause confusion for users that do not know what this is supposed to be in the first place. Remove this directory from our templates and, now that we do not require the workaround anymore, restructure the templates to form a proper hierarchy. This makes it way easier for build systems to install these templates into place. We should likely think about removing support for "branch/" altogether, but that is outside of the scope of this patch series. Signed-off-by: Patrick Steinhardt --- contrib/buildsystems/CMakeLists.txt | 8 +--- templates/Makefile | 38 ++++++++++++------- templates/branches-- | 1 - templates/{this--description => description} | 0 .../applypatch-msg.sample} | 0 .../commit-msg.sample} | 0 .../fsmonitor-watchman.sample} | 0 .../post-update.sample} | 0 .../pre-applypatch.sample} | 0 .../pre-commit.sample} | 0 .../pre-merge-commit.sample} | 0 .../pre-push.sample} | 0 .../pre-rebase.sample} | 0 .../pre-receive.sample} | 0 .../prepare-commit-msg.sample} | 0 .../push-to-checkout.sample} | 0 .../sendemail-validate.sample} | 0 .../update.sample} | 0 templates/{info--exclude => info/exclude} | 0 19 files changed, 25 insertions(+), 22 deletions(-) delete mode 100644 templates/branches-- rename templates/{this--description => description} (100%) rename templates/{hooks--applypatch-msg.sample => hooks/applypatch-msg.sample} (100%) rename templates/{hooks--commit-msg.sample => hooks/commit-msg.sample} (100%) rename templates/{hooks--fsmonitor-watchman.sample => hooks/fsmonitor-watchman.sample} (100%) rename templates/{hooks--post-update.sample => hooks/post-update.sample} (100%) rename templates/{hooks--pre-applypatch.sample => hooks/pre-applypatch.sample} (100%) rename templates/{hooks--pre-commit.sample => hooks/pre-commit.sample} (100%) rename templates/{hooks--pre-merge-commit.sample => hooks/pre-merge-commit.sample} (100%) rename templates/{hooks--pre-push.sample => hooks/pre-push.sample} (100%) rename templates/{hooks--pre-rebase.sample => hooks/pre-rebase.sample} (100%) rename templates/{hooks--pre-receive.sample => hooks/pre-receive.sample} (100%) rename templates/{hooks--prepare-commit-msg.sample => hooks/prepare-commit-msg.sample} (100%) rename templates/{hooks--push-to-checkout.sample => hooks/push-to-checkout.sample} (100%) rename templates/{hooks--sendemail-validate.sample => hooks/sendemail-validate.sample} (100%) rename templates/{hooks--update.sample => hooks/update.sample} (100%) rename templates/{info--exclude => info/exclude} (100%) diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index e32ce8ce8b7..b95287468cd 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -878,23 +878,17 @@ endforeach() #templates -file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/*") +file(GLOB templates "${CMAKE_SOURCE_DIR}/templates/**") list(TRANSFORM templates REPLACE "${CMAKE_SOURCE_DIR}/templates/" "") list(REMOVE_ITEM templates ".gitignore") list(REMOVE_ITEM templates "Makefile") list(REMOVE_ITEM templates "blt")# Prevents an error when reconfiguring for in source builds -list(REMOVE_ITEM templates "branches--") -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/templates/blt/branches) #create branches - #templates have @.*@ replacement so use configure_file instead foreach(tm ${templates}) - string(REPLACE "--" "/" blt_tm ${tm}) - string(REPLACE "this" "" blt_tm ${blt_tm})# for this-- configure_file(${CMAKE_SOURCE_DIR}/templates/${tm} ${CMAKE_BINARY_DIR}/templates/blt/${blt_tm} @ONLY) endforeach() - #translations if(MSGFMT_EXE) file(GLOB po_files "${CMAKE_SOURCE_DIR}/po/*.po") diff --git a/templates/Makefile b/templates/Makefile index 367ad00c24c..0b91d189257 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -29,24 +29,34 @@ all: boilerplates.made custom # in a file direc--tory--file in the source. They will be # just copied to the destination. -bpsrc = $(filter-out %~,$(wildcard *--*)) -boilerplates.made : $(bpsrc) - $(QUIET)umask 022 && ls *--* 2>/dev/null | \ - while read boilerplate; \ +TEMPLATES = description +TEMPLATES += hooks/applypatch-msg.sample +TEMPLATES += hooks/commit-msg.sample +TEMPLATES += hooks/fsmonitor-watchman.sample +TEMPLATES += hooks/post-update.sample +TEMPLATES += hooks/pre-applypatch.sample +TEMPLATES += hooks/pre-commit.sample +TEMPLATES += hooks/pre-merge-commit.sample +TEMPLATES += hooks/prepare-commit-msg.sample +TEMPLATES += hooks/pre-push.sample +TEMPLATES += hooks/pre-rebase.sample +TEMPLATES += hooks/pre-receive.sample +TEMPLATES += hooks/push-to-checkout.sample +TEMPLATES += hooks/sendemail-validate.sample +TEMPLATES += hooks/update.sample +TEMPLATES += info/exclude + +boilerplates.made: $(TEMPLATES) + $(QUIET)umask 022 && for template in $(TEMPLATES); \ do \ - case "$$boilerplate" in *~) continue ;; esac && \ - dst=`echo "$$boilerplate" | sed -e 's|^this|.|;s|--|/|g'` && \ - dir=`expr "$$dst" : '\(.*\)/'` && \ + dir=$$(dirname "$$template") && \ mkdir -p blt/$$dir && \ - case "$$boilerplate" in \ - *--) continue;; \ - esac && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ - -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$boilerplate > \ - blt/$$dst && \ - if test -x "$$boilerplate"; then rx=rx; else rx=r; fi && \ - chmod a+$$rx "blt/$$dst" || exit; \ + -e 's|@PERL_PATH@|$(PERL_PATH_SQ)|g' $$template > \ + blt/$$template && \ + if test -x "$$template"; then rx=rx; else rx=r; fi && \ + chmod a+$$rx "blt/$$template" || exit; \ done && \ date >$@ diff --git a/templates/branches-- b/templates/branches-- deleted file mode 100644 index fae88709a63..00000000000 --- a/templates/branches-- +++ /dev/null @@ -1 +0,0 @@ -: this is just to ensure the directory exists. diff --git a/templates/this--description b/templates/description similarity index 100% rename from templates/this--description rename to templates/description diff --git a/templates/hooks--applypatch-msg.sample b/templates/hooks/applypatch-msg.sample similarity index 100% rename from templates/hooks--applypatch-msg.sample rename to templates/hooks/applypatch-msg.sample diff --git a/templates/hooks--commit-msg.sample b/templates/hooks/commit-msg.sample similarity index 100% rename from templates/hooks--commit-msg.sample rename to templates/hooks/commit-msg.sample diff --git a/templates/hooks--fsmonitor-watchman.sample b/templates/hooks/fsmonitor-watchman.sample similarity index 100% rename from templates/hooks--fsmonitor-watchman.sample rename to templates/hooks/fsmonitor-watchman.sample diff --git a/templates/hooks--post-update.sample b/templates/hooks/post-update.sample similarity index 100% rename from templates/hooks--post-update.sample rename to templates/hooks/post-update.sample diff --git a/templates/hooks--pre-applypatch.sample b/templates/hooks/pre-applypatch.sample similarity index 100% rename from templates/hooks--pre-applypatch.sample rename to templates/hooks/pre-applypatch.sample diff --git a/templates/hooks--pre-commit.sample b/templates/hooks/pre-commit.sample similarity index 100% rename from templates/hooks--pre-commit.sample rename to templates/hooks/pre-commit.sample diff --git a/templates/hooks--pre-merge-commit.sample b/templates/hooks/pre-merge-commit.sample similarity index 100% rename from templates/hooks--pre-merge-commit.sample rename to templates/hooks/pre-merge-commit.sample diff --git a/templates/hooks--pre-push.sample b/templates/hooks/pre-push.sample similarity index 100% rename from templates/hooks--pre-push.sample rename to templates/hooks/pre-push.sample diff --git a/templates/hooks--pre-rebase.sample b/templates/hooks/pre-rebase.sample similarity index 100% rename from templates/hooks--pre-rebase.sample rename to templates/hooks/pre-rebase.sample diff --git a/templates/hooks--pre-receive.sample b/templates/hooks/pre-receive.sample similarity index 100% rename from templates/hooks--pre-receive.sample rename to templates/hooks/pre-receive.sample diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks/prepare-commit-msg.sample similarity index 100% rename from templates/hooks--prepare-commit-msg.sample rename to templates/hooks/prepare-commit-msg.sample diff --git a/templates/hooks--push-to-checkout.sample b/templates/hooks/push-to-checkout.sample similarity index 100% rename from templates/hooks--push-to-checkout.sample rename to templates/hooks/push-to-checkout.sample diff --git a/templates/hooks--sendemail-validate.sample b/templates/hooks/sendemail-validate.sample similarity index 100% rename from templates/hooks--sendemail-validate.sample rename to templates/hooks/sendemail-validate.sample diff --git a/templates/hooks--update.sample b/templates/hooks/update.sample similarity index 100% rename from templates/hooks--update.sample rename to templates/hooks/update.sample diff --git a/templates/info--exclude b/templates/info/exclude similarity index 100% rename from templates/info--exclude rename to templates/info/exclude From patchwork Wed Oct 9 14:57:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828587 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 292D21E00AB for ; Wed, 9 Oct 2024 14:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485834; cv=none; b=mm916NS93mLXqhwzPfHcxnKQTUACFn0VIJzTHut221bh20hdkVK/H5JJsMPrrXqCRqj0ZoPjCljdnGxvW5B+MOkeGiokUGqW1B/dgKZdysb9bwQEvkOeRvhzxdAIpyRDqwCRe/pPrCVnnCFKDuImyydYjd0+ndlevIc6tNKMWO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485834; c=relaxed/simple; bh=tymBAXt0Hwn6z5TIsexqx+fydviDih27pZ0rNcxcKD4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gquGjRIQyvYcyub4P+8FUwyfPzyOEde6itmdUQ7VGIjcguJZ0wqRKJMpQ3vW6thUbKHVHjNwMsWpCDC9XW1d3oHYFN/2URSahHKoVbBWmcUjAeKF2yFO/PvMATFzcFUWN8rQKDMHOiC/C0THi/TSKWtgi0hFVAm4QW+Oy9Pb+nU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=aZwCyHo4; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=b0/3KuU4; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="aZwCyHo4"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="b0/3KuU4" Received: from phl-compute-02.internal (phl-compute-02.phl.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id 873BD13801D8; Wed, 9 Oct 2024 10:57:12 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-02.internal (MEProxy); Wed, 09 Oct 2024 10:57:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485832; x=1728572232; bh=bNj569NXAr 9px6QicReMLIwoO9rHXhNPmo0PSNx4MLM=; b=aZwCyHo4m4UMIUN+hvveAOMcfi 2WJrlZ0HCgjzvaMip8NbGp+3nNExm23PBdnEwMlES4bRYR/X3owjk13cCN7ka1RB xxXBbaUfbJ4qXiPBFw+gEorLNDdf+nAT9EupQx0psXTod+d2yEjgjlTmkEm5QItx mGofjyDtP729CneWBf13D7KiPPnaUvvbNO95kJocvxa0oCIkh7u7OZJkQCvOxCGI M2qYj+Pc59Yjr6/2upnlGm704xzesjAueM7oGvFt+S38Az50iaITKyILoYstgYOF 0f7CssHd3JqopvNbbI9JEDRSqZV9A5Qu4CzSWnIf0r+y9alkJB+cilSMhtjg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485832; x=1728572232; bh=bNj569NXAr9px6QicReMLIwoO9rH XhNPmo0PSNx4MLM=; b=b0/3KuU4fndXsE+ZYLNVe1Sbkxp95eaun55hwG9osQvG HIgOmryvgNlcQTDYKQn2hMXHnSmaqEX+Jwqygjb+o3NTC4lhP8FZDHOMFmuYGjqw 8SeSwqsX+efCNHzzWbnG9MNBqgdMW3lmSVHARbIW331XRbUQi6JYzFYdvB/KRWCb Y1gsdtMTyn2cQzm6jZ5bxD8ibMHd/EpUE8ORWwunTnwGS4bjTPWaOpie018nKRPB VxQnmOLFI/BuYTHXLILadvQ1A+XnThauvMmzrQncBySgUZv8fkykm91IdjPXiTSj QnOrkhU5enIyNZ8F3w+vBb/ZG0E8xPHgCGn8Q3Y/hg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepheenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithhsthgvrhesphhosghogidrtghomhdprhgtph htthhopehsuhhnshhhihhnvgesshhunhhshhhinhgvtghordgtohhmpdhrtghpthhtohep phhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdprhgtphhtthhopegvsh gthhifrghrthiisehgvghnthhoohdrohhrghdprhgtphhtthhopehgihhtsehvghgvrhdr khgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:11 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 395c695c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:56:07 +0000 (UTC) Date: Wed, 9 Oct 2024 16:57:09 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 21/24] t: better support for out-of-tree builds Message-ID: <1172c44060024eac3f10a615add8969ca98157a2.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Our in-tree builds used by the Makefile use various different build directories scattered around different locations. The paths to those build directories have to be propagated to our tests such that they can find the contained files. This is done via a mixture of hardcoded paths in our test library and injected variables in our bin-wrappers or "GIT-BUILD-OPTIONS". The latter two mechanisms are preferable over using hardcoded paths. For one, we have all paths which are subject to change stored in a small set of central files instead of having the knowledge of build paths in many files. And second, it allows build systems which build files elsewhere to adapt those paths based on their own needs. This is especially nice in the context of build systems that use out-of-tree builds like CMake or Meson. Remove hardcoded knowledge of build paths from our test library and move it into our bin-wrappers and "GIT-BUILD-OPTIONS". Signed-off-by: Patrick Steinhardt --- GIT-BUILD-OPTIONS.in | 5 +++++ Makefile | 9 +++++++++ bin-wrappers/wrap-for-bin.sh | 11 ++++++----- contrib/buildsystems/CMakeLists.txt | 8 ++++++++ t/lib-gettext.sh | 4 ++-- t/t7609-mergetool--lib.sh | 2 +- t/test-lib.sh | 6 +++--- 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in index f0ca240493c..cce06577840 100644 --- a/GIT-BUILD-OPTIONS.in +++ b/GIT-BUILD-OPTIONS.in @@ -33,4 +33,9 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@ GIT_INTEROP_MAKE_OPTS=@GIT_INTEROP_MAKE_OPTS@ GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@ GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@ +GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@ +GIT_TEST_POPATH=@GIT_TEST_POPATH@ +GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@ +GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@ +GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@ RUNTIME_PREFIX=@RUNTIME_PREFIX@ diff --git a/Makefile b/Makefile index 554d8ea83b2..7764d3e284c 100644 --- a/Makefile +++ b/Makefile @@ -3194,6 +3194,11 @@ GIT-BUILD-OPTIONS: FORCE -e "s|@GIT_INTEROP_MAKE_OPTS@|\'$(GIT_INTEROP_MAKE_OPTS)\'|" \ -e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \ -e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \ + -e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \ + -e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \ + -e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \ + -e "s|@GIT_TEST_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \ + -e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \ -e "s|@RUNTIME_PREFIX@|\'$(RUNTIME_PREFIX)\'|" \ GIT-BUILD-OPTIONS.in >$@+ @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi @@ -3218,6 +3223,10 @@ all:: $(TEST_PROGRAMS) $(test_bindir_programs) $(UNIT_TEST_PROGS) $(CLAR_TEST_PR bin-wrappers/%: bin-wrappers/wrap-for-bin.sh $(QUIET_GEN)sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e 's|@BUILD_DIR@|$(shell pwd)|' \ + -e 's|@GIT_TEXTDOMAINDIR@|$(shell pwd)/po/build/locale|' \ + -e 's|@GITPERLLIB@|$(shell pwd)/perl/build/lib|' \ + -e 's|@MERGE_TOOLS_DIR@|$(shell pwd)/mergetools|' \ + -e 's|@TEMPLATE_DIR@|$(shell pwd)/templates/blt|' \ -e 's|@PROG@|$(patsubst test-%,t/helper/test-%,$(@F))$(if $(filter-out $(BINDIR_PROGRAMS_NO_X),$(@F)),$(X),)|' < $< > $@ && \ chmod +x $@ diff --git a/bin-wrappers/wrap-for-bin.sh b/bin-wrappers/wrap-for-bin.sh index 7898a1c238d..1d3a59a0081 100755 --- a/bin-wrappers/wrap-for-bin.sh +++ b/bin-wrappers/wrap-for-bin.sh @@ -4,21 +4,22 @@ # to run test suite against sandbox, but with only bindir-installed # executables in PATH. The Makefile copies this into various # files in bin-wrappers, substituting -# @BUILD_DIR@ and @PROG@. +# @BUILD_DIR@, @TEMPLATE_DIR@ and @PROG@. GIT_EXEC_PATH='@BUILD_DIR@' if test -n "$NO_SET_GIT_TEMPLATE_DIR" then unset GIT_TEMPLATE_DIR else - GIT_TEMPLATE_DIR='@BUILD_DIR@/templates/blt' + GIT_TEMPLATE_DIR='@TEMPLATE_DIR@' export GIT_TEMPLATE_DIR fi -GITPERLLIB='@BUILD_DIR@/perl/build/lib'"${GITPERLLIB:+:$GITPERLLIB}" -GIT_TEXTDOMAINDIR='@BUILD_DIR@/po/build/locale' +MERGE_TOOLS_DIR='@MERGE_TOOLS_DIR@' +GITPERLLIB='@GITPERLLIB@'"${GITPERLLIB:+:$GITPERLLIB}" +GIT_TEXTDOMAINDIR='@GIT_TEXTDOMAINDIR@' PATH='@BUILD_DIR@/bin-wrappers:'"$PATH" -export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR +export MERGE_TOOLS_DIR GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR case "$GIT_DEBUGGER" in '') diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt index b95287468cd..bf5e2b5c08d 100644 --- a/contrib/buildsystems/CMakeLists.txt +++ b/contrib/buildsystems/CMakeLists.txt @@ -1087,6 +1087,9 @@ endforeach() file(STRINGS ${CMAKE_SOURCE_DIR}/bin-wrappers/wrap-for-bin.sh content NEWLINE_CONSUME) string(REPLACE "@BUILD_DIR@" "${CMAKE_BINARY_DIR}" content "${content}") +string(REPLACE "@GIT_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" content "${content}") +string(REPLACE "@GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" content "${content}") +string(REPLACE "@MERGE_TOOLS_DIR@" "${CMAKE_SOURCE_DIR}/mergetools" content "${content}") string(REPLACE "@PROG@" "git-cvsserver" content "${content}") file(WRITE ${CMAKE_BINARY_DIR}/bin-wrappers/git-cvsserver ${content}) @@ -1171,6 +1174,11 @@ string(REPLACE "@GIT_INTEROP_MAKE_OPTS@" "" git_build_options "${git_build_optio string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}") string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" git_build_options "${git_build_options}") string(REPLACE "@RUNTIME_PREFIX@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_TEXTDOMAINDIR@" "${CMAKE_BINARY_DIR}/po/build/locale" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_POPATH@" "${CMAKE_BINARY_DIR}/po" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_TEMPLATE_DIR@" "${CMAKE_BINARY_DIR}/templates/blt" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_GITPERLLIB@" "${CMAKE_BINARY_DIR}/perl/build/lib" git_build_options "${git_build_options}") +string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "${RUNTIME_PREFIX}" git_build_options "${git_build_options}") if(USE_VCPKG) string(APPEND git_build_options "PATH=\"$PATH:$TEST_DIRECTORY/../compat/vcbuild/vcpkg/installed/x64-windows/bin\"\n") endif() diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh index cc6bb2cdeaa..7a734c6973e 100644 --- a/t/lib-gettext.sh +++ b/t/lib-gettext.sh @@ -6,8 +6,8 @@ . ./test-lib.sh -GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" -GIT_PO_PATH="$GIT_BUILD_DIR/po" +GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR" +GIT_PO_PATH="$GIT_TEST_POPATH" export GIT_TEXTDOMAINDIR GIT_PO_PATH if test -n "$GIT_TEST_INSTALLED" diff --git a/t/t7609-mergetool--lib.sh b/t/t7609-mergetool--lib.sh index 8b1c3bd39f2..a9273ba58d7 100755 --- a/t/t7609-mergetool--lib.sh +++ b/t/t7609-mergetool--lib.sh @@ -8,7 +8,7 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'mergetool --tool=vimdiff creates the expected layout' ' - . "$GIT_BUILD_DIR"/mergetools/vimdiff && + . "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff && run_unit_tests ' diff --git a/t/test-lib.sh b/t/test-lib.sh index 4dd641baefe..677424ced06 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1478,7 +1478,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes: PATH="$GIT_BUILD_DIR:$GIT_BUILD_DIR/t/helper:$PATH" fi fi -GIT_TEMPLATE_DIR="$GIT_BUILD_DIR"/templates/blt +GIT_TEMPLATE_DIR="$GIT_TEST_TEMPLATE_DIR" GIT_CONFIG_NOSYSTEM=1 GIT_ATTR_NOSYSTEM=1 GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.." @@ -1494,9 +1494,9 @@ then fi fi -GITPERLLIB="$GIT_BUILD_DIR"/perl/build/lib +GITPERLLIB="$GIT_TEST_GITPERLLIB" export GITPERLLIB -test -d "$GIT_BUILD_DIR"/templates/blt || { +test -d "$GIT_TEMPLATE_DIR" || { BAIL_OUT "You haven't built things yet, have you?" } From patchwork Wed Oct 9 14:57:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828588 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3F481E0489 for ; Wed, 9 Oct 2024 14:57:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485837; cv=none; b=tJB9wk7BNjsaeqaclI9sUMFG0FWzOW6mcToz9v/yaEyJL5Fqty7lNtDRqYUBBCzZxvQd01nDyDBxu7vG7tBazKoWyvgWFmNZAMthtbHUBxd0ObNbkD9ZVejV8gSn/hq9Stpbe6HrHCqVOQNMn7tDvK+zZfyGFsrzI0XlEXaKngk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485837; c=relaxed/simple; bh=LzrMZS8SOrFaA7rJy/l+ZrivqB1OIvWmVDxOeGUPzhE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BEQlBN4UzNaOhrSwOa6M00gW0k7mj8mSfBagyLK+qqIIsPBEG/ingvvS+yzYBvXLJ7BsrJt1QTrczvnz2330tlhzQpd8qLmC597qsUWyGGuMAHZH7JkRsfeM7SL32zL5Te+YDmsygEmTGkrVmcl4xQ82xpEutkSwgoNTqWG2ec8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=T3dLvfgr; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=IbJSYpEx; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="T3dLvfgr"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="IbJSYpEx" Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 05502114015D; Wed, 9 Oct 2024 10:57:15 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Wed, 09 Oct 2024 10:57:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485835; x=1728572235; bh=m9rOFqWALe H04MMhZTCFnVAon7cxhTEPn/4acBhy0vk=; b=T3dLvfgr5b6Z5kvGFgjRWQrmDp egh1ycPre6lsiFvaXy+ICSRj05x5z9D762tgDjoedRnUQbJ5khbA4E3vH38FnJks nIBUMdwg+R58LH0MSgKjArJrk3mXa0Vqc16dR/yzEGTMRJitTbGlNo3MNFuFM8Zj 9YNFRMLXZvQO78rqtZme7xIp6WZveZkI1l4GACbqogzrxU0RTq8ybLbUbHB03q8j IOPPyAZVsWb9+QkjxFJOy5gkhAOO9LRKYCetorvOdiVeqknMJmDF27Gul2JbPkjZ IONowJHHVuwUPHQ/XlrSi0i7pea9N2ZbCaMGZ0SxLs7jT2nFNW3oN4sOJX4w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485835; x=1728572235; bh=m9rOFqWALeH04MMhZTCFnVAon7cx hTEPn/4acBhy0vk=; b=IbJSYpEx1JKd7DVp4wrdxwv5sepzjQ0TZ/OaDQX2cCVv p9BS2tgcRZCI0s5Al/a+I0/sDBX4jjMh3l3eqGlvTcXodbsy1pYnHce4yEjoKcpK 8rP6wjp341afB426WeCEdRpQfemRak6aqbzCIFzgPrqsD/t/busK14HUB3nAXOR8 RTeQ7Ha7pdYeoD3ROHXqbCqkXlBALYILyHzBDj1ZY5VN6J3+7CqHBC7npGppfCTm b4RuSZtsGTvLcpieQmvPzftb4R0fyvmxM4vbVw5d/wc4neYeaJwSO4Pzqn7d5iF4 VDwbGN3uzbinvtNVeb+m+dwLTeJz8LU5oy+zZBX1KA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveekkeffhfeitdeludeigfejtdetvdelvdduhefgueeg udfghfeukefhjedvkedtnecuvehluhhsthgvrhfuihiivgepfeenucfrrghrrghmpehmrg hilhhfrhhomhepphhssehpkhhsrdhimhdpnhgspghrtghpthhtohephedpmhhouggvpehs mhhtphhouhhtpdhrtghpthhtohepghhithesvhhgvghrrdhkvghrnhgvlhdrohhrghdprh gtphhtthhopehgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepshhunhhs hhhinhgvsehsuhhnshhhihhnvggtohdrtghomhdprhgtphhtthhopegvshgthhifrghrth iisehgvghnthhoohdrohhrghdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdef sehgmhgrihhlrdgtohhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:13 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 112b8ce9 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:56:10 +0000 (UTC) Date: Wed, 9 Oct 2024 16:57:12 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 22/24] t: allow overriding build dir Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Our "test-lib.sh" assumes that our build directory is the parent directory of "t/". While true when using our Makefile, it's not when using build systems that support out-of-tree builds. In commit ee9e66e4e7 (cmake: avoid editing t/test-lib.sh, 2022-10-18), we have introduce support for overriding the GIT_BIULD_DIR by creating the file "$GIT_BUILD_DIR/GIT-BUILD-DIR" with its contents pointing to the location of the build directory. The intent was to stop modifying "t/test-lib.sh" with the CMake build systems while allowing out-of-tree builds. But "$GIT_BUILD_DIR" is somewhat misleadingly named, as it in fact points to the _source_ directory. So while that commit solved part of the problem for out-of-tree builds, CMake still has to write files into the source tree. Solve the second part of the problem, namely not having to write any data into the source directory at all, by also supporting an environment variable that allows us to point to a different build directory. This allows us to perform properly self-contained out-of-tree builds. Signed-off-by: Patrick Steinhardt --- t/test-lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/test-lib.sh b/t/test-lib.sh index 677424ced06..096af9be6b1 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -35,7 +35,7 @@ else # needing to exist. TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1 fi -GIT_BUILD_DIR="${TEST_DIRECTORY%/t}" +GIT_BUILD_DIR="${GIT_BUILD_DIR:-${TEST_DIRECTORY%/t}}" if test "$TEST_DIRECTORY" = "$GIT_BUILD_DIR" then echo "PANIC: Running in a $TEST_DIRECTORY that doesn't end in '/t'?" >&2 @@ -513,6 +513,7 @@ unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e ' PERF_ CURL_VERBOSE TRACE_CURL + BUILD_DIR )); my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env); print join("\n", @vars); From patchwork Wed Oct 9 14:57:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828589 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 220941E04AB for ; Wed, 9 Oct 2024 14:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485840; cv=none; b=HNOjte5ucRLo+8luU/wcX7hZN2hV7/6qw54QghH54f+xEMdii7lDiYu/26n5U/7ciDk6FkXAMkRPBKZQyLgjber37RYo7elFVKdQ2Y0heCKRNvJlFw46M+ClRGWgBmXiQ5YSm80rUdrZUrxzVBisJyK+7AFqX9rMLEIkkFAs0zo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485840; c=relaxed/simple; bh=G81sCg0MFwqFpGM9PB6dQ38WCcrO9cj3Z2dEAFFn8jQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=l84sMRfKCiAVfDe0JkVzs6BKCzckYdCtH+KR0iLn/QmhVX2epBc5k6ct0khVBz6ozVh8f4PY5lESpdHpi5psvUzrcvvVfudxnJGBXjhUx7mdimR113/F/gedh+RxYEtIKOpl2YyrMrlrTQ4clLbvqvl3ep3fOqPDFCYaA/V5xgY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=s89LzHNZ; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=E94AvV37; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="s89LzHNZ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="E94AvV37" Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 6E59D13801D8; Wed, 9 Oct 2024 10:57:17 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Wed, 09 Oct 2024 10:57:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485837; x=1728572237; bh=RxkhLDYqDN jeKTYgO+j/fWLs4FgLarIgZxprYIzTr0Q=; b=s89LzHNZsuUWAM4gsW60+TeaVi 3XfAmbTsnN/QBZSEO6x4eorxw649wM3bB/+6kPwr0CGmtf6+e839H5x++S3ESyEO K1u6f0bhjneKvJEU/VixIGTJ0Li56J4lXjuCGuH72EJfK+Iny49cm6HJ6kkYYaj3 VEsp2FGoaDheO76yRHd4NTXVFZsTUL2Iiu9Ckca7Y0Ik7XgtJahitW/4cH4xpp0X NkpgkgHGZXkR0ZB+AfR8M5OdNOoG4tkr7PVradT2niHPFep993KEJ3nDAj1ILS6P +MtRwTydNYfQKQeXyWblwGNqeXM1scqlrh0CYGmOZOsf8k03ayV0YcO44C/g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485837; x=1728572237; bh=RxkhLDYqDNjeKTYgO+j/fWLs4FgL arIgZxprYIzTr0Q=; b=E94AvV37hb84aazvZAbyS5a/0kchxPnSI+hI9M1asMTZ aiAyqRNKZ9vnsGZs1cH7bqTAVuAvDc7HJhmmnJ8Z76jzMvkvbeoHZUdcYV/wcmer n3vtNHA9LY58Uhz638SDi25Mrx0GAibYYrN6lmwW5n2w+kHco/ZbWWvNHH02Lxmr Oa0uYKLKx7VL2YQ+49KQsy+0G6xNMi4j0jPhMBzR+oiIsVZ25K/sIhsv9MFrb4vB psNPRaoVbB2m0nVbJIKiXspS1gR0gE6EH+RsRN2xzGP23/ssCi5TI9AF22K8UqX7 17xWDBmVldR2C+gz0Q6LJZOEAhxi0rGjW5WLvdUiJQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepveefffdtgfekhfdttdejhefgffffjedtfeelueetgfeh heehudeihffgjedvkeegnecuffhomhgrihhnpehtgihtrdgruhhtohenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesphhkshdrihhmpdhn sggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehgihhtse hvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepghhithhsthgvrhesphhosgho gidrtghomhdprhgtphhtthhopehsuhhnshhhihhnvgesshhunhhshhhinhgvtghordgtoh hmpdhrtghpthhtohepphhhihhllhhiphdrfihoohguuddvfeesghhmrghilhdrtghomhdp rhgtphhtthhopegvshgthhifrghrthiisehgvghnthhoohdrohhrgh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:16 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id e77e517f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:56:13 +0000 (UTC) Date: Wed, 9 Oct 2024 16:57:15 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 23/24] Documentation: add comparison of build systems Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: We're contemplating whether to eventually replace our build systems with a build system that is easier to use. Add a comparison of build systems to our technical documentation as a baseline for discussion. Signed-off-by: Patrick Steinhardt --- Documentation/Makefile | 1 + Documentation/technical/build-systems.txt | 224 ++++++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 Documentation/technical/build-systems.txt diff --git a/Documentation/Makefile b/Documentation/Makefile index 0f55baa252f..e23cffb5f9a 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -111,6 +111,7 @@ TECH_DOCS += MyFirstObjectWalk TECH_DOCS += SubmittingPatches TECH_DOCS += ToolsForGit TECH_DOCS += technical/bitmap-format +TECH_DOCS += technical/build-systems TECH_DOCS += technical/bundle-uri TECH_DOCS += technical/hash-function-transition TECH_DOCS += technical/long-running-process-protocol diff --git a/Documentation/technical/build-systems.txt b/Documentation/technical/build-systems.txt new file mode 100644 index 00000000000..c00d9b71978 --- /dev/null +++ b/Documentation/technical/build-systems.txt @@ -0,0 +1,224 @@ += Build Systems + +The build system is the primary way for both developers and system integrators +to interact with the Git project. As such, being easy to use and extend for +those who are not directly developing Git itself is just as important as other +requirements we have on any potential build system. + +This document outlines the different requirements that we have for the build +system and then compares available build systems using these criteria. + +== Requirements + +The following subsections present a list of requirements that we have for any +potential build system. Sections are sorted by decreasing priority, even though +these priorities will naturally differ between users. + +=== Platform support + +The build system must have support for all of our primary platforms as outlined +by. These platforms are: + + - Linux + - Windows + - macOS + +Furthermore, the build system should have support for the following secondary +platforms: + + - AIX + - FreeBSD + - NetBSD + - OpenBSD + +The platforms which must be supported by the tool should be aligned with our +[platform support policy](platform-support.txt). + +=== Auto-detection of supported features + +The build system must support auto-detection of features which are or aren't +available on the current platform. Platform maintainers should not be required +to manually configure the complete build. + +Auto-detection of the following items is considered to be important: + + - Check for the existence of headers. + - Check for the existence of libraries. + - Check for the existence of exectuables. + - Check for the runtime behavior of specific functions. + - Check for specific link order requirements when multiple libraries are + involved. + +=== Ease of use + +The build system should be both easy to use and easy to extend. While this is +naturally a subjective metric it is likely not controversial to say that some +build systems are considerably harder to use than others. + +=== IDE support + +The build system should integrate with well-known IDEs. Well-known IDEs include: + + - Microsoft Visual Studio + - Visual Studio Code + - Xcode + +There are four levels of support: + + - Native integration into the IDE. + - Integration into the IDE via a plugin. + - Integration into the IDE via generating a project description with the build + system. + - No integration. + +Native integration is preferable, but integration via either a plugin or by +generating a project description via the build system are considered feasible +alternatives. + +Another important distinction is the level of integration. There are two +features that one generally wants to have: + + - Integration of build targets. + - Automatic setup of features like code completion with detected build + dependencies. + +The first bullet point is the bare minimum, but is not sufficient to be +considered proper integration. + +=== Out-of-tree builds + +The build system should support out-of-tree builds. Out-of-tree builds allow a +developer to configure multiple different build directories with different +configuration, e.g. one "debug" build and one "release" build. + +=== Cross-platform builds + +The build system should support cross-platform builds, e.g. building for arm on +an x86-64 host. + +=== Language support + +The following languages and toolchains are of relevance and should be supported +by the build system: + + - C: the primary compiled language used by Git, must be supported. Relevant + toolchains are GCC, Clang and MSVC. + - Rust: candidate as a second compiled lanugage, should be supported. Relevant + toolchains is the LLVM-based rustc. + +Built-in support for the respective languages is preferred over support that +needs to be wired up manually to avoid unnecessary complexity. Native support +includes the following features: + + - Compiling objects. + - Dependency tracking. + - Detection of available features. + - Discovery of relevant toolchains. + - Linking libraries and executables. + +=== Test integration + +It should be possible to integrate tests into the build system such that it is +possible to build and test Git within the build system. Features which are nice +to have: + + - Track build-time dependencies for respective tests. Unit tests have + different requirements than integration tests. + - Allow filtering of which tests to run. + - Allow interactive tests that drop the user into a shell with `test_pause` or + `debug`. + +== Comparison + +The following list of build systems are considered: + +- GNU Make +- autoconf +- CMake +- Meson + +=== GNU Make + +- Platform support: ubitquitous on all platforms, but not well-integrated into Windows. +- Auto-detection: no built-in support for auto-detection of features. +- Ease of use: easy to use, but discovering available options is hard. Makefile + rules can quickly get out of hand once reaching a certain scope. +- IDE support: execution of Makefile targets is supported by many IDEs +- Out-of-tree builds: supported in theory, not wired up in practice. +- Cross-platform builds: supported in theory, not wired up in practice. +- Language support: + - C: Limited built-in support, many parts need to be wired up manually. + - Rust: No built-in support, needs to be wired up manually. +- Test integration: partially supported, many parts need to be wired up + manually. + +=== autoconf + +- Platform support: ubiquitous on all platforms, but not well-integrated into Windows. +- Auto-detection: supported. +- Ease of use: easy to use, discovering available options is comparatively + easy. The autoconf syntax is prohibitively hard to extend though due to its + complex set of interacting files and the hard-to-understand M4 language. +- IDE support: no integration into IDEs at generation time. The generated + Makefiles have the same level of support as GNU Make. +- Out-of-tree builds: supported in theory, not wired up in practice. +- Cross-platform builds: supported. +- Language support: + - C: Limited built-in support, many parts need to be wired up manually. + - Rust: No built-in support, needs to be wired up manually. +- Test integration: partially supported, many parts need to be wired up + manually. + +=== CMake + +- Platform support: not as extensive as GNU Make or autoconf, but all major + platforms are supported. + - AIX + - Cygwin + - FreeBSD + - Linux + - OpenBSD + - Solaris + - Windows + - macOS +- Ease of use: easy to use, discovering available options is not always + trivial. The scripting language used by CMake is somewhat cumbersome to use, + but extending CMake build instructions is doable. +- IDE support: natively integrated into Microsoft Visual Studio. Can generate + project descriptions for Xcode. An extension is available for Visual Studio + Code. Many other IDEs have plugins for CMake. +- Out-of-tree builds: supported. +- Cross-platform builds: supported. +- Language support: + - C: Supported for GCC, Clang, MSVC and other toolchains. + - Rust: No built-in support, needs to be wired up manually. +- Test integration: supported, even though test dependencies are a bit + cumbersome to use via "test fixtures". Interactive test runs are not + supported. + +=== Meson + +- Platform: not as extensive as GNU Make or autoconf, but all major platforms + and some smaller ones are supported. + - AIX + - Cygwin + - DragonflyBSD + - FreeBSD + - Haiku + - Linux + - NetBSD + - OpenBSD + - Solaris + - Windows + - macOS +- Ease of use: easy to use, discovering available options is easy. The + scripting language is straight-forward to use. +- IDE support: Supports generating build instructions for Xcode and Microsoft + Visual Studio, a plugin exists for Visual Studio Code. +- Out-of-tree builds: supported. +- Cross-platform builds: supported. +- Language support: + - C: Supported for GCC, Clang, MSVC and other toolchains. + - Rust: Supported for rustc. +- Test integration: supported. Interactive tests are supported starting with + Meson 1.5.0 via the `--interactive` flag. From patchwork Wed Oct 9 14:57:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13828590 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 359311E0B8F for ; Wed, 9 Oct 2024 14:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.159 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485849; cv=none; b=NNdcXqafz0n0uBNclJXNwH2rDu5gNXiT8TM5k7HRWInjkNuMLV5IDlNTbf4OI9lYK5MdeWTs2ySt0tZENTsTsppDGkWPwkKdfWwcOUGX/bPuOi5/70taZYhA38HahSPZzLf1OpHaSp7uU4/n0ZdEQnwecapwIEVKaUEKsMezjTM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728485849; c=relaxed/simple; bh=peTyTNB2bXB7CRUXIpoUAF2bnzEJVsbzDBKhoAuFNLY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Er2LkPfXLY3IoS+GShuHjur01qWyLQVaY5K2PrN7VI+//acv6ylDrZxKyi547/2K6Fz/2xtUx+swbqlmsoBR2PgeY+Kpl/gvSnyMI0SnVmAOgcjo8tqtsiwh4gtmWU8u+p1D5h8vfqVDTtjKGMGD8hx5TOBnPvP44juZGoiOltM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=kLi6mA1k; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=F6lGa+WV; arc=none smtp.client-ip=103.168.172.159 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="kLi6mA1k"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="F6lGa+WV" Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 4626D1140170; Wed, 9 Oct 2024 10:57:23 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Wed, 09 Oct 2024 10:57:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1728485843; x=1728572243; bh=9nSU0pZLtY zeTP4AdPk0ub52ArRd2rf8e+SzpDFfFLM=; b=kLi6mA1kuczAZS+8kQWtTeX5SO 5GOA4zDCQG1D2CfAA2kyGFJLsiK+Ou6bE/JzkAbXPPB7OXNOG3OU5/8HTIb/MR+U sOD0GCcNnXaSUa6440Oe94SG9I68Rf0R1QxeyhfgnkzQEnG+1DTawMYqBLVDZiet UgpagWxehIHfkeH9j0pvYHGWGuYOKc5cUcHqKv/fU7VXZvC6UYNzdBDWBtoEbWUQ uypYDSgUD6U19zVt/7u9qLjIlsHlpSU4jiHfU5OXchKRJ6scVwv2PZU2ct4Y4PFk ukFVjIUUaAIlNbcM/c04ZAGNGjH6KGMYCOZGGjRlb4Mk1zPA8PKr2sbdekSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1728485843; x=1728572243; bh=9nSU0pZLtYzeTP4AdPk0ub52ArRd 2rf8e+SzpDFfFLM=; b=F6lGa+WVjAQ/zZ2mL/KZRTAgqmmF+3nSTjOm6TVOGSP4 GP9uhLtkjPdWqwZhvcYt6jxIMJF61cLXD0ETIFUyf48Vo5QoSRDz2GpbuZa3miea Lx9vkAOCoDvDrRZzbjHIFEmlicVx1M9ZtKgheV0G1nm4zHTgj7uNYH6cAdLxf+Mj R4v5TV3Bh2nwdQROWbnjOwYLeAgAsL1jFCnulEO3awFWnszhfVIyADDnBhWw1/aK 2vw5lSL3SKCPLD61TkgTfu4pQ66oK/CTIffh4v5YUBONlPmuJ1R2kAT5+ClksRTO zXKkUisxWl7jynNQvE9wCWtMgfNbnKsLsazz+ZjMEQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgkeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvden ucfhrhhomheprfgrthhrihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimh eqnecuggftrfgrthhtvghrnhepieekfeethfehhedttdfhgeffvedvlefhueehledtjedv heehfedvveegkeeuieefnecuffhomhgrihhnpehgihhthhhusgdrtghomhdpmhgvshhonh gsuhhilhgurdgtohhmpdhophgvnhhsshhlrdhorhhgpdiilhhisgdrnhgvthdphhhtthhp ugdrshhhpdhhthhtphdqshhhrghllhhofidrshhhpdhhthhtphdqphhushhhqdifvggsug grvhdrshhhpdhhthhtphdqphhushhhqdhsmhgrrhhtrdhshhdphhhtthhprdhshhdphhht thhpqdhfvghttghhqdguuhhmsgdrshhhpdhhthhtphdqfhgvthgthhdqshhmrghrthdrsh hhpdhhthhtphdqshhmrghrthdqtghomhhmohhnrdhshhdphhhtthhpqdhgvghtrdhshhdp hhhtthhpqdhfvghttghhqdhsmhgrrhhtqdhhthhtphdvrdhshhdphhhtthhpqdgsrggtkh gvnhguqdhnohhsvghrvhgvrhdrshhhpdhhthhtphdqsggrtghkvghnugdrshhhpdhhthht phdqsggrtghkvghnugdqtghonhhtvghnthdqlhgvnhhgthhhrdhshhdphhhtthhpqdgruh hthhdrshhhpdhhthhtphdqphhrohighidrshhhpdhhthhtphdqtghurhhlqdhvvghrsgho shgvrdhshhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehpshesphhkshdrihhmpdhnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopegvshgthhifrghrthiisehgvghnthhoohdrohhrghdprhgtphhtth hopehgihhtshhtvghrsehpohgsohigrdgtohhmpdhrtghpthhtohepghhithesvhhgvghr rdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehphhhilhhlihhprdifohhougduvdefse hgmhgrihhlrdgtohhmpdhrtghpthhtohepshhunhhshhhinhgvsehsuhhnshhhihhnvggt ohdrtghomh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 10:57:21 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id bd03814d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 9 Oct 2024 14:56:18 +0000 (UTC) Date: Wed, 9 Oct 2024 16:57:17 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Eli Schwartz , Eric Sunshine , Phillip Wood , Junio C Hamano Subject: [RFC PATCH v2 24/24] Introduce support for the Meson build system Message-ID: <724232b0fad2cbd5602ac1e900fd5dafff666012.1728485139.git.ps@pks.im> References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Introduce support for the Meson build system, a "modern" meta build system that supports many different plaforms, including Linux, macOS, Windows and BSDs. Meson supports different backends, including Ninja, Xcode and Microsoft Visual Studio. Several common IDEs provide an integration with it. The biggest contender compared to Meson is probably CMake as outlined in our "Documentation/technical/build-systems.txt" file. Based on my own personal experience from working with both build systems extensively I strongly favor Meson over CMake. In my opinion, it feels significantly easier to use with a syntax that feels more like a "real" programming language. The second big reason is that Meson supports Rust natively, which may prove to be important given that the project is likely to pick up Rust as another language eventually. Using Meson is rather straight-forward. An example: ``` # Meson uses out-of-tree builds. You can set up multiple build # directories, how you name them is completely up to you. $ mkdir build $ cd build $ meson setup .. -Dprefix=/tmp/git-installation # Build the project. This also provides several other targets like e.g. `install` or `test`. $ ninja # Meson has been wired up to support execution of our test suites. # Both our unit tests and our integration tests are supported. # Running `meson test` without any arguments will execute all tests, # but the syntax supports globbing to select only some tests. $ meson test 't-*' # Execute single test interactively to allow fordebugging. $ meson test 't0000-*' --interactive --test-args=-ix ``` The build instructions have been successfully tested on the following systems, tests are passing: - Apple macOS 10.15. - FreeBSD 14.1, except gitweb-based tests. - NixOS 24.11. - Ubuntu 24.04. - Windows 10 with Cygwin, using `-Dperl=disabled -Dpython=disabled`. - Windows 10 with MinGW64, using `-Dperl=disabled -Dpython=disabled`. - Windows 10 with MSVC 2022, using `-Dperl=disabled -Dpython=disabled -Dgettext=disabled -Diconv=disabled --wrap-mode=forcefallback`. It is expected that there will still be rough edges in the current version. If this patch lands the expectation is that it will coexist with our other build systems for a while. Like this, distributions can slowly migrate over to Meson and report any findings they have to us such that we can continue to iterate. A potential cutoff date for other build systems may be Git 3.0. Some notes: - The installed distribution is structured somewhat differently than how it used to be the case. All of our binaries are installed into `$libexec/git-core`, while all binaries part of `$bindir` are now symbolic links pointing to the former. This rule is consistent in itself and thus easier to reason about. - We do not install dashed binaries into `$libexec/git-core` anymore. So there won't e.g. be a symlink for git-add(1). These are not required by modern Git and there isn't really much of a usecase for those anymore. By not installing those symlinks we thus start the deprecation of this layout. - Support for installing documentation has not been wired up yet. This will follow if the project can agree on Meson as build system. - Documentation does not yet exist. Same here, it will follow if the project can agree on Meson. - We're targeting a Meson 1.3.0, which has been released relatively recently November 2023. The only feature we use from that version is `fs.relative_to()`, which we could replace if necessary. If so, we could start to target Meson 1.0.0 and newer, released in December 2022. - The whole build instructions count around 3000 lines, half of which is listing all of our code and test files. Our Makefiles are around 5000 lines, autoconf adds another 1300 lines. CMake in comparison has only 1200 linescode, but it avoids listing individual files and does not wire up auto-configuration as extensively as the Meson instructions do. - We bundle a set of subproject wrappers for curl, expat, openssl, pcre2 and zlib. This allows developers to build Git without these dependencies preinstalled, and Meson will fetch and build them automatically. This is especially helpful on Windows. Signed-off-by: Patrick Steinhardt --- bin-wrappers/meson.build | 28 + contrib/completion/meson.build | 8 + contrib/meson.build | 1 + gitweb/meson.build | 32 + gitweb/static/meson.build | 28 + meson.build | 1607 ++++++++++++++++++++++++++++ meson_options.txt | 70 ++ perl/FromCPAN/Mail/meson.build | 7 + perl/FromCPAN/meson.build | 9 + perl/Git/LoadCPAN/Mail/meson.build | 7 + perl/Git/LoadCPAN/meson.build | 9 + perl/Git/SVN/Memoize/meson.build | 7 + perl/Git/SVN/meson.build | 20 + perl/Git/meson.build | 18 + perl/meson.build | 18 + po/meson.build | 28 + subprojects/curl.wrap | 13 + subprojects/expat.wrap | 13 + subprojects/openssl.wrap | 15 + subprojects/pcre2.wrap | 16 + subprojects/zlib.wrap | 13 + t/helper/meson.build | 91 ++ t/meson.build | 1105 +++++++++++++++++++ templates/hooks/meson.build | 24 + templates/info/meson.build | 5 + templates/meson.build | 8 + 26 files changed, 3200 insertions(+) create mode 100644 bin-wrappers/meson.build create mode 100644 contrib/completion/meson.build create mode 100644 contrib/meson.build create mode 100644 gitweb/meson.build create mode 100644 gitweb/static/meson.build create mode 100644 meson.build create mode 100644 meson_options.txt create mode 100644 perl/FromCPAN/Mail/meson.build create mode 100644 perl/FromCPAN/meson.build create mode 100644 perl/Git/LoadCPAN/Mail/meson.build create mode 100644 perl/Git/LoadCPAN/meson.build create mode 100644 perl/Git/SVN/Memoize/meson.build create mode 100644 perl/Git/SVN/meson.build create mode 100644 perl/Git/meson.build create mode 100644 perl/meson.build create mode 100644 po/meson.build create mode 100644 subprojects/curl.wrap create mode 100644 subprojects/expat.wrap create mode 100644 subprojects/openssl.wrap create mode 100644 subprojects/pcre2.wrap create mode 100644 subprojects/zlib.wrap create mode 100644 t/helper/meson.build create mode 100644 t/meson.build create mode 100644 templates/hooks/meson.build create mode 100644 templates/info/meson.build create mode 100644 templates/meson.build diff --git a/bin-wrappers/meson.build b/bin-wrappers/meson.build new file mode 100644 index 00000000000..6d03a19d7b8 --- /dev/null +++ b/bin-wrappers/meson.build @@ -0,0 +1,28 @@ +bin_wrappers_config = configuration_data() +foreach key, value : { + 'BUILD_DIR': meson.project_build_root(), + 'MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools', + 'TEMPLATE_DIR': meson.project_build_root() / 'templates', + 'GIT_TEXTDOMAINDIR': meson.project_build_root() / 'po', + 'GITPERLLIB': meson.project_build_root() / 'perl/lib', +} + # Paths need to be Unix-style without drive prefixes as they get added to the + # PATH variable. And given that drive prefixes contain a colon we'd otherwise + # end up with a broken PATH if we didn't convert them. + if cygpath.found() + value = run_command(cygpath, value, check: true).stdout().strip() + endif + bin_wrappers_config.set(key, value) +endforeach + +foreach executable : bin_wrappers + executable_config = configuration_data() + executable_config.merge_from(bin_wrappers_config) + executable_config.set('PROG', fs.relative_to(executable.full_path(), meson.project_build_root())) + + configure_file( + input: 'wrap-for-bin.sh', + output: fs.stem(executable.full_path()), + configuration: executable_config, + ) +endforeach diff --git a/contrib/completion/meson.build b/contrib/completion/meson.build new file mode 100644 index 00000000000..a9bfe2da312 --- /dev/null +++ b/contrib/completion/meson.build @@ -0,0 +1,8 @@ +foreach script : [ + 'git-completion.bash', + 'git-completion.tcsh', + 'git-completion.zsh', + 'git-prompt.sh' +] + test_dependencies += fs.copyfile(script) +endforeach diff --git a/contrib/meson.build b/contrib/meson.build new file mode 100644 index 00000000000..a7b77b87c22 --- /dev/null +++ b/contrib/meson.build @@ -0,0 +1 @@ +subdir('completion') diff --git a/gitweb/meson.build b/gitweb/meson.build new file mode 100644 index 00000000000..f9c3a766472 --- /dev/null +++ b/gitweb/meson.build @@ -0,0 +1,32 @@ +configure_file( + input: 'gitweb.perl', + output: 'gitweb.cgi', + configuration: { + 'GIT_VERSION': meson.project_version(), + 'GIT_BINDIR': get_option('prefix') / get_option('bindir'), + 'GITWEB_CONFIG': get_option('gitweb_config'), + 'GITWEB_CONFIG_SYSTEM': get_option('gitweb_config_system'), + 'GITWEB_CONFIG_COMMON': get_option('gitweb_config_common'), + 'GITWEB_HOME_LINK_STR': get_option('gitweb_home_link_str'), + 'GITWEB_SITENAME': get_option('gitweb_sitename'), + 'GITWEB_PROJECTROOT': get_option('gitweb_projectroot'), + 'GITWEB_PROJECT_MAXDEPTH': get_option('gitweb_project_maxdepth'), + 'GITWEB_EXPORT_OK': get_option('gitweb_export_ok'), + 'GITWEB_STRICT_EXPORT': get_option('gitweb_strict_export'), + 'GITWEB_BASE_URL': get_option('gitweb_base_url'), + 'GITWEB_LIST': get_option('gitweb_list'), + 'GITWEB_HOMETEXT': get_option('gitweb_hometext'), + 'GITWEB_CSS': get_option('gitweb_css'), + 'GITWEB_LOGO': get_option('gitweb_logo'), + 'GITWEB_FAVICON': get_option('gitweb_favicon'), + 'GITWEB_JS': get_option('gitweb_js'), + 'GITWEB_SITE_HTML_HEAD_STRING': get_option('gitweb_site_html_head_string'), + 'GITWEB_SITE_HEADER': get_option('gitweb_site_header'), + 'GITWEB_SITE_FOOTER': get_option('gitweb_site_footer'), + 'HIGHLIGHT_BIN': get_option('highlight_bin'), + }, + install: true, + install_dir: get_option('datadir') / 'gitweb', +) + +subdir('static') diff --git a/gitweb/static/meson.build b/gitweb/static/meson.build new file mode 100644 index 00000000000..1bdbe70d2d6 --- /dev/null +++ b/gitweb/static/meson.build @@ -0,0 +1,28 @@ +foreach asset : [ + 'git-favicon.png', + 'git-logo.png', + 'gitweb.css', +] + fs.copyfile(asset, + install: true, + install_dir: get_option('datadir') / 'gitweb/static', + ) +endforeach + +javascript_sources = [ + meson.current_source_dir() / 'js/adjust-timezone.js', + meson.current_source_dir() / 'js/blame_incremental.js', + meson.current_source_dir() / 'js/javascript-detection.js', + meson.current_source_dir() / 'js/lib/common-lib.js', + meson.current_source_dir() / 'js/lib/cookies.js', + meson.current_source_dir() / 'js/lib/datetime.js', +] + +custom_target( + input: javascript_sources, + output: 'gitweb.js', + capture: true, + command: ['cat'] + javascript_sources, + install: true, + install_dir: get_option('datadir') / 'gitweb/static', +) diff --git a/meson.build b/meson.build new file mode 100644 index 00000000000..338d472bc66 --- /dev/null +++ b/meson.build @@ -0,0 +1,1607 @@ +project('git', 'c', + meson_version: '>=1.3.0', + # MSVC does not support GNU99, and C99 does not define __STDC_VERSION__ + # on MSVC. So we instead fall back to C11 there. + default_options: ['c_std=gnu99,c11'], + version: run_command('GIT-VERSION-GEN', check: true).stdout().strip(), +) + +fs = import('fs') + +compiler = meson.get_compiler('c') + +cygpath = find_program('cygpath', required: false) +shell = find_program('sh') +tar = find_program('tar') +diff = find_program('diff') + +libgit_sources = [ + 'abspath.c', + 'add-interactive.c', + 'add-patch.c', + 'advice.c', + 'alias.c', + 'alloc.c', + 'apply.c', + 'archive-tar.c', + 'archive-zip.c', + 'archive.c', + 'attr.c', + 'base85.c', + 'bisect.c', + 'blame.c', + 'blob.c', + 'bloom.c', + 'branch.c', + 'bulk-checkin.c', + 'bundle-uri.c', + 'bundle.c', + 'cache-tree.c', + 'cbtree.c', + 'chdir-notify.c', + 'checkout.c', + 'chunk-format.c', + 'color.c', + 'column.c', + 'combine-diff.c', + 'commit-graph.c', + 'commit-reach.c', + 'commit.c', + 'compat/nonblock.c', + 'compat/obstack.c', + 'compat/terminal.c', + 'compat/zlib-uncompress2.c', + 'config.c', + 'connect.c', + 'connected.c', + 'convert.c', + 'copy.c', + 'credential.c', + 'csum-file.c', + 'ctype.c', + 'date.c', + 'decorate.c', + 'delta-islands.c', + 'diagnose.c', + 'diff-delta.c', + 'diff-merges.c', + 'diff-lib.c', + 'diff-no-index.c', + 'diff.c', + 'diffcore-break.c', + 'diffcore-delta.c', + 'diffcore-order.c', + 'diffcore-pickaxe.c', + 'diffcore-rename.c', + 'diffcore-rotate.c', + 'dir-iterator.c', + 'dir.c', + 'editor.c', + 'entry.c', + 'environment.c', + 'ewah/bitmap.c', + 'ewah/ewah_bitmap.c', + 'ewah/ewah_io.c', + 'ewah/ewah_rlw.c', + 'exec-cmd.c', + 'fetch-negotiator.c', + 'fetch-pack.c', + 'fmt-merge-msg.c', + 'fsck.c', + 'fsmonitor.c', + 'fsmonitor-ipc.c', + 'fsmonitor-settings.c', + 'gettext.c', + 'git-zlib.c', + 'gpg-interface.c', + 'graph.c', + 'grep.c', + 'hash-lookup.c', + 'hashmap.c', + 'help.c', + 'hex.c', + 'hex-ll.c', + 'hook.c', + 'ident.c', + 'json-writer.c', + 'kwset.c', + 'levenshtein.c', + 'line-log.c', + 'line-range.c', + 'linear-assignment.c', + 'list-objects-filter-options.c', + 'list-objects-filter.c', + 'list-objects.c', + 'lockfile.c', + 'log-tree.c', + 'loose.c', + 'ls-refs.c', + 'mailinfo.c', + 'mailmap.c', + 'match-trees.c', + 'mem-pool.c', + 'merge-blobs.c', + 'merge-ll.c', + 'merge-ort.c', + 'merge-ort-wrappers.c', + 'merge-recursive.c', + 'merge.c', + 'midx.c', + 'midx-write.c', + 'name-hash.c', + 'negotiator/default.c', + 'negotiator/noop.c', + 'negotiator/skipping.c', + 'notes-cache.c', + 'notes-merge.c', + 'notes-utils.c', + 'notes.c', + 'object-file-convert.c', + 'object-file.c', + 'object-name.c', + 'object.c', + 'oid-array.c', + 'oidmap.c', + 'oidset.c', + 'oidtree.c', + 'pack-bitmap-write.c', + 'pack-bitmap.c', + 'pack-check.c', + 'pack-mtimes.c', + 'pack-objects.c', + 'pack-revindex.c', + 'pack-write.c', + 'packfile.c', + 'pager.c', + 'parallel-checkout.c', + 'parse.c', + 'parse-options-cb.c', + 'parse-options.c', + 'patch-delta.c', + 'patch-ids.c', + 'path.c', + 'pathspec.c', + 'pkt-line.c', + 'preload-index.c', + 'pretty.c', + 'prio-queue.c', + 'progress.c', + 'promisor-remote.c', + 'prompt.c', + 'protocol.c', + 'protocol-caps.c', + 'prune-packed.c', + 'pseudo-merge.c', + 'quote.c', + 'range-diff.c', + 'reachable.c', + 'read-cache.c', + 'rebase-interactive.c', + 'rebase.c', + 'ref-filter.c', + 'reflog-walk.c', + 'reflog.c', + 'refs.c', + 'refs/debug.c', + 'refs/files-backend.c', + 'refs/reftable-backend.c', + 'refs/iterator.c', + 'refs/packed-backend.c', + 'refs/ref-cache.c', + 'refspec.c', + 'reftable/basics.c', + 'reftable/error.c', + 'reftable/block.c', + 'reftable/blocksource.c', + 'reftable/iter.c', + 'reftable/publicbasics.c', + 'reftable/merged.c', + 'reftable/pq.c', + 'reftable/reader.c', + 'reftable/record.c', + 'reftable/stack.c', + 'reftable/tree.c', + 'reftable/writer.c', + 'remote.c', + 'replace-object.c', + 'repo-settings.c', + 'repository.c', + 'rerere.c', + 'reset.c', + 'resolve-undo.c', + 'revision.c', + 'run-command.c', + 'send-pack.c', + 'sequencer.c', + 'serve.c', + 'server-info.c', + 'setup.c', + 'shallow.c', + 'sideband.c', + 'sigchain.c', + 'sparse-index.c', + 'split-index.c', + 'stable-qsort.c', + 'statinfo.c', + 'strbuf.c', + 'streaming.c', + 'string-list.c', + 'strmap.c', + 'strvec.c', + 'sub-process.c', + 'submodule-config.c', + 'submodule.c', + 'symlinks.c', + 'tag.c', + 'tempfile.c', + 'thread-utils.c', + 'tmp-objdir.c', + 'trace.c', + 'trace2.c', + 'trace2/tr2_cfg.c', + 'trace2/tr2_cmd_name.c', + 'trace2/tr2_ctr.c', + 'trace2/tr2_dst.c', + 'trace2/tr2_sid.c', + 'trace2/tr2_sysenv.c', + 'trace2/tr2_tbuf.c', + 'trace2/tr2_tgt_event.c', + 'trace2/tr2_tgt_normal.c', + 'trace2/tr2_tgt_perf.c', + 'trace2/tr2_tls.c', + 'trace2/tr2_tmr.c', + 'trailer.c', + 'transport-helper.c', + 'transport.c', + 'tree-diff.c', + 'tree-walk.c', + 'tree.c', + 'unpack-trees.c', + 'upload-pack.c', + 'url.c', + 'urlmatch.c', + 'usage.c', + 'userdiff.c', + 'utf8.c', + 'varint.c', + 'versioncmp.c', + 'walker.c', + 'wildmatch.c', + 'worktree.c', + 'wrapper.c', + 'write-or-die.c', + 'ws.c', + 'wt-status.c', + 'xdiff-interface.c', + 'xdiff/xdiffi.c', + 'xdiff/xemit.c', + 'xdiff/xhistogram.c', + 'xdiff/xmerge.c', + 'xdiff/xpatience.c', + 'xdiff/xprepare.c', + 'xdiff/xutils.c', +] + +builtin_sources = [ + 'builtin/add.c', + 'builtin/am.c', + 'builtin/annotate.c', + 'builtin/apply.c', + 'builtin/archive.c', + 'builtin/bisect.c', + 'builtin/blame.c', + 'builtin/branch.c', + 'builtin/bugreport.c', + 'builtin/bundle.c', + 'builtin/cat-file.c', + 'builtin/check-attr.c', + 'builtin/check-ignore.c', + 'builtin/check-mailmap.c', + 'builtin/check-ref-format.c', + 'builtin/checkout--worker.c', + 'builtin/checkout-index.c', + 'builtin/checkout.c', + 'builtin/clean.c', + 'builtin/clone.c', + 'builtin/column.c', + 'builtin/commit-graph.c', + 'builtin/commit-tree.c', + 'builtin/commit.c', + 'builtin/config.c', + 'builtin/count-objects.c', + 'builtin/credential-cache--daemon.c', + 'builtin/credential-cache.c', + 'builtin/credential-store.c', + 'builtin/credential.c', + 'builtin/describe.c', + 'builtin/diagnose.c', + 'builtin/diff-files.c', + 'builtin/diff-index.c', + 'builtin/diff-tree.c', + 'builtin/diff.c', + 'builtin/difftool.c', + 'builtin/fast-export.c', + 'builtin/fast-import.c', + 'builtin/fetch-pack.c', + 'builtin/fetch.c', + 'builtin/fmt-merge-msg.c', + 'builtin/for-each-ref.c', + 'builtin/for-each-repo.c', + 'builtin/fsck.c', + 'builtin/fsmonitor--daemon.c', + 'builtin/gc.c', + 'builtin/get-tar-commit-id.c', + 'builtin/grep.c', + 'builtin/hash-object.c', + 'builtin/help.c', + 'builtin/hook.c', + 'builtin/index-pack.c', + 'builtin/init-db.c', + 'builtin/interpret-trailers.c', + 'builtin/log.c', + 'builtin/ls-files.c', + 'builtin/ls-remote.c', + 'builtin/ls-tree.c', + 'builtin/mailinfo.c', + 'builtin/mailsplit.c', + 'builtin/merge-base.c', + 'builtin/merge-file.c', + 'builtin/merge-index.c', + 'builtin/merge-ours.c', + 'builtin/merge-recursive.c', + 'builtin/merge-tree.c', + 'builtin/merge.c', + 'builtin/mktag.c', + 'builtin/mktree.c', + 'builtin/multi-pack-index.c', + 'builtin/mv.c', + 'builtin/name-rev.c', + 'builtin/notes.c', + 'builtin/pack-objects.c', + 'builtin/pack-redundant.c', + 'builtin/pack-refs.c', + 'builtin/patch-id.c', + 'builtin/prune-packed.c', + 'builtin/prune.c', + 'builtin/pull.c', + 'builtin/push.c', + 'builtin/range-diff.c', + 'builtin/read-tree.c', + 'builtin/rebase.c', + 'builtin/receive-pack.c', + 'builtin/reflog.c', + 'builtin/refs.c', + 'builtin/remote-ext.c', + 'builtin/remote-fd.c', + 'builtin/remote.c', + 'builtin/repack.c', + 'builtin/replace.c', + 'builtin/replay.c', + 'builtin/rerere.c', + 'builtin/reset.c', + 'builtin/rev-list.c', + 'builtin/rev-parse.c', + 'builtin/revert.c', + 'builtin/rm.c', + 'builtin/send-pack.c', + 'builtin/shortlog.c', + 'builtin/show-branch.c', + 'builtin/show-index.c', + 'builtin/show-ref.c', + 'builtin/sparse-checkout.c', + 'builtin/stash.c', + 'builtin/stripspace.c', + 'builtin/submodule--helper.c', + 'builtin/symbolic-ref.c', + 'builtin/tag.c', + 'builtin/unpack-file.c', + 'builtin/unpack-objects.c', + 'builtin/update-index.c', + 'builtin/update-ref.c', + 'builtin/update-server-info.c', + 'builtin/upload-archive.c', + 'builtin/upload-pack.c', + 'builtin/var.c', + 'builtin/verify-commit.c', + 'builtin/verify-pack.c', + 'builtin/verify-tag.c', + 'builtin/worktree.c', + 'builtin/write-tree.c', +] + +script_environment = environment() +foreach tool : ['cat', 'cut', 'grep', 'sed', 'sort', 'tr', 'uname'] + program = find_program(tool) + script_environment.prepend('PATH', fs.parent(program.full_path())) +endforeach + +libgit_sources += custom_target( + 'command-list.h', + input: 'command-list.txt', + output: 'command-list.h', + command: [shell, meson.current_source_dir() + '/generate-cmdlist.sh', meson.current_source_dir(), '@OUTPUT@'], + env: script_environment, +) + +libgit_sources += custom_target( + 'config-list.h', + output: 'config-list.h', + command: [ + shell, + meson.current_source_dir() + '/generate-configlist.sh', + meson.current_source_dir(), + '@OUTPUT@', + ], + env: script_environment, +) + +libgit_sources += custom_target( + 'hook-list.h', + input: 'Documentation/githooks.txt', + output: 'hook-list.h', + command: [ + shell, + meson.current_source_dir() + '/generate-hooklist.sh', + meson.current_source_dir(), + '@OUTPUT@', + ], + env: script_environment, +) + +# This contains the variables for GIT-BUILD-OPTIONS, which we use to propagate +# build options to our tests. +build_options_config = configuration_data() +build_options_config.set('GIT_INTEROP_MAKE_OPTS', '') +build_options_config.set('GIT_PERF_LARGE_REPO', '') +build_options_config.set('GIT_PERF_MAKE_COMMAND', '') +build_options_config.set('GIT_PERF_MAKE_OPTS', '') +build_options_config.set('GIT_PERF_REPEAT_COUNT', '') +build_options_config.set('GIT_PERF_REPO', '') +build_options_config.set('GIT_TEST_CMP_USE_COPIED_CONTEXT', '') +build_options_config.set('GIT_TEST_INDEX_VERSION', '') +build_options_config.set('GIT_TEST_OPTS', '') +build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '') +build_options_config.set('GIT_TEST_UTF8_LOCALE', '') +build_options_config.set('SANITIZE_ADDRESS', '') +build_options_config.set('SANITIZE_LEAK', '') + +test_output_directory = get_option('test_output_directory') +if test_output_directory == '' + test_output_directory = meson.project_build_root() / 'test-output' +endif + +# These variables are used for building libgit.a. +libgit_c_args = [ + '-DBINDIR="' + get_option('bindir') + '"', + '-DDEFAULT_EDITOR="' + get_option('default_editor') + '"', + '-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"', + '-DDEFAULT_HELP_FORMAT="' + get_option('default_help_format') + '"', + '-DDEFAULT_PAGER="' + get_option('default_pager') + '"', + '-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"', + '-DETC_GITCONFIG="' + get_option('gitconfig') + '"', + '-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"', + '-DGIT_EXEC_PATH="' + get_option('prefix') / get_option('libexecdir') / 'git-core"', + '-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"', + '-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"', + '-DGIT_INFO_PATH="' + get_option('infodir') + '"', + '-DGIT_LOCALE_PATH="' + get_option('localedir') + '"', + '-DGIT_MAN_PATH="' + get_option('mandir') + '"', + '-DPAGER_ENV="' + get_option('pager_environment') + '"', + '-DSHELL_PATH="' + fs.as_posix(shell.full_path()) + '"', +] +libgit_include_directories = [ '.' ] +libgit_dependencies = [ ] + +executable_suffix = '' +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + executable_suffix = '.exe' + libgit_c_args += '-DSTRIP_EXTENSION="' + executable_suffix + '"' +endif +build_options_config.set_quoted('X', executable_suffix) + +python = import('python').find_installation('python3', required: get_option('python')) +if python.found() + build_options_config.set('NO_PYTHON', '') +else + libgit_c_args += '-DNO_PYTHON' + build_options_config.set('NO_PYTHON', '1') +endif + +# Perl is used for two different things: our test harness and to provide some +# features. It is optional if you want to neither execute tests nor use any of +# these optional features. +perl_required = get_option('perl') +if get_option('tests') + perl_required = true +endif + +# Note that we only set NO_PERL if the Perl features were disabled by the user. +# It may not be set when we have found Perl, but only use it to run tests. +perl = find_program('perl', version: '>=5.8.1', required: perl_required) +perl_features_enabled = perl.found() and get_option('perl').allowed() +if perl_features_enabled + build_options_config.set('NO_PERL', '') +else + libgit_c_args += '-DNO_PERL' + build_options_config.set('NO_PERL', '1') +endif + +zlib = dependency('zlib', default_options: ['default_library=static', 'tests=disabled']) +if zlib.type_name() != 'internal' and not compiler.has_function('deflateBound', + prefix: '#include ', + dependencies: zlib, +) + libgit_c_args += '-DNO_DEFLATE_BOUND' +endif +libgit_dependencies += zlib + +threads = dependency('threads', required: false) +if threads.found() + libgit_dependencies += threads + build_options_config.set('NO_PTHREADS', '') +else + libgit_c_args += '-DNO_PTHREADS' + build_options_config.set('NO_PTHREADS', '1') +endif + +if get_option('gettext').allowed() and host_machine.system() == 'darwin' and get_option('macos_use_homebrew_gettext') + if host_machine.cpu_family() == 'x86_64' + libintl_prefix = '/usr/local' + elif host_machine.cpu_family() == 'aarch64' + libintl_prefix = '/opt/homebrew' + else + error('Homebrew workaround not supported on current architecture') + endif + + intl = compiler.find_library('intl', dirs: libintl_prefix / 'lib', required: get_option('gettext')) + if intl.found() + intl = declare_dependency( + dependencies: intl, + include_directories: libintl_prefix / 'include', + ) + endif +else + intl = dependency('intl', required: get_option('gettext')) +endif +if intl.found() + libgit_dependencies += intl + build_options_config.set('NO_GETTEXT', '') +else + libgit_c_args += '-DNO_GETTEXT' + build_options_config.set('NO_GETTEXT', '1') +endif + +iconv = dependency('iconv', required: get_option('iconv')) +if iconv.found() + libgit_dependencies += iconv + build_options_config.set('NO_ICONV', '') + + have_old_iconv = false + if not compiler.compiles(''' + #include + + extern size_t iconv(iconv_t cd, + char **inbuf, size_t *inbytesleft, + char **outbuf, size_t *outbytesleft); + ''', name: 'old iconv interface', dependencies: [iconv]) + libgit_c_args += '-DOLD_ICONV' + have_old_iconv = true + endif + + iconv_omits_bom_source = '''# + #include + + int main(int argc, const char **argv) + { + ''' + if have_old_iconv + iconv_omits_bom_source += ''' + typedef const char *iconv_ibp; + ''' + else + iconv_omits_bom_source += ''' + typedef char *iconv_ibp; + ''' + endif + iconv_omits_bom_source += ''' + int v; + iconv_t conv; + char in[] = "a"; iconv_ibp pin = in; + char out[20] = ""; char *pout = out; + size_t isz = sizeof in; + size_t osz = sizeof out; + + conv = iconv_open("UTF-16", "UTF-8"); + iconv(conv, &pin, &isz, &pout, &osz); + iconv_close(conv); + v = (unsigned char)(out[0]) + (unsigned char)(out[1]); + return v != 0xfe + 0xff; + } + ''' + + if compiler.run(iconv_omits_bom_source, + dependencies: iconv, + name: 'iconv omits BOM', + ).returncode() != 0 + libgit_c_args += '-DICONV_OMITS_BOM' + endif +else + libgit_c_args += '-DNO_ICONV' + build_options_config.set('NO_ICONV', '1') +endif + +pcre2 = dependency('libpcre2-8', required: get_option('pcre2'), default_options: ['default_library=static', 'test=false']) +if pcre2.found() + libgit_dependencies += pcre2 + libgit_c_args += '-DUSE_LIBPCRE2' + build_options_config.set('USE_LIBPCRE2', '1') +else + build_options_config.set('USE_LIBPCRE2', '') +endif + +curl = dependency('libcurl', version: '>=7.21.3', required: get_option('curl'), default_options: ['default_library=static', 'tests=disabled']) +use_curl_for_imap_send = false +if curl.found() + if curl.version().version_compare('>=7.34.0') + libgit_c_args += '-DUSE_CURL_FOR_IMAP_SEND' + use_curl_for_imap_send = true + endif + + libgit_dependencies += curl + libgit_c_args += '-DCURL_DISABLE_TYPECHECK' + build_options_config.set('NO_CURL', '') +else + libgit_c_args += '-DNO_CURL' + build_options_config.set('NO_CURL', '1') +endif + +expat = dependency('expat', required: get_option('expat'), default_options: ['default_library=static', 'build_tests=false']) +if expat.found() + libgit_dependencies += expat + + if expat.version().version_compare('<=1.2') + libgit_c_args += '-DEXPAT_NEEDS_XMLPARSE_H' + endif + build_options_config.set('NO_EXPAT', '') +else + libgit_c_args += '-DNO_EXPAT' + build_options_config.set('NO_EXPAT', '1') +endif + +if not compiler.has_header('sys/select.h') + libgit_c_args += '-DNO_SYS_SELECT_H' +endif + +has_poll_h = compiler.has_header('poll.h') +if not has_poll_h + libgit_c_args += '-DNO_POLL_H' +endif + +has_sys_poll_h = compiler.has_header('sys/poll.h') +if not has_sys_poll_h + libgit_c_args += '-DNO_SYS_POLL_H' +endif + +if not has_poll_h and not has_sys_poll_h + libgit_c_args += '-DNO_POLL' + libgit_sources += 'compat/poll/poll.c' + libgit_include_directories += 'compat/poll' +endif + +if not compiler.has_header('inttypes.h') + libgit_c_args += '-DNO_INTTYPES_H' +endif + +if compiler.has_header('libcharset.h') + libcharset = compiler.find_library('charset') + + if compiler.has_function('locale_charset', + prefix: '#include ', + dependencies: iconv, + ) + libgit_c_args += '-DHAVE_LIBCHARSET_H' + elif compiler.has_function('locale_charset', + prefix: '#include ', + dependencies: libcharset, + ) + libgit_c_args += '-DHAVE_LIBCHARSET_H' + endif +endif + +if compiler.has_header('alloca.h') + libgit_c_args += '-DHAVE_ALLOCA_H' +endif + +if compiler.has_header('sys/sysinfo.h') + libgit_c_args += '-DHAVE_SYSINFO' +endif + +# Windows has libgen.h and a basename implementation, but we still need our own +# implementation to threat things like drive prefixes specially. +if host_machine.system() == 'windows' or not compiler.has_header('libgen.h') + libgit_c_args += '-DNO_LIBGEN_H' + libgit_sources += 'compat/basename.c' +endif + +if compiler.has_header('paths.h') + libgit_c_args += '-DHAVE_PATHS_H' +endif + +if compiler.has_header('strings.h') + libgit_c_args += '-DHAVE_STRINGS_H' +endif + +networking_dependencies = [ ] +if host_machine.system() == 'windows' + winsock = compiler.find_library('ws2_32', required: false) + if winsock.found() + networking_dependencies += winsock + endif +else + libresolv = compiler.find_library('resolv', required: false) + if libresolv.found() + networking_dependencies += libresolv + endif +endif +libgit_dependencies += networking_dependencies + +foreach symbol : ['inet_ntop', 'inet_pton', 'strerror'] + if not compiler.has_function(symbol, dependencies: networking_dependencies) + libgit_c_args += '-DNO_' + symbol.to_upper() + endif +endforeach + +has_ipv6 = compiler.has_function('getaddrinfo', dependencies: networking_dependencies) +if not has_ipv6 + libgit_c_args += '-DNO_IPV6' +endif + +if not compiler.compiles(''' + #ifdef _WIN32 + # include + #else + # include + # include + #endif + + void func(void) + { + struct sockaddr_storage x; + } +''', name: 'struct sockaddr_storage') + if has_ipv6 + libgit_c_args += '-Dsockaddr_storage=sockaddr_in6' + else + libgit_c_args += '-Dsockaddr_storage=sockaddr_in' + endif +endif + +if compiler.has_function('socket', dependencies: networking_dependencies) + libgit_sources += [ + 'unix-socket.c', + 'unix-stream-server.c', + ] + build_options_config.set('NO_UNIX_SOCKETS', '') +else + libgit_c_args += '-DNO_UNIX_SOCKETS' + build_options_config.set('NO_UNIX_SOCKETS', '1') +endif + +if not compiler.has_function('pread') + libgit_c_args += '-DNO_PREAD' + libgit_sources += 'compat/pread.c' +endif + +if host_machine.system() == 'darwin' + libgit_sources += 'compat/precompose_utf8.c' + libgit_c_args += '-DPRECOMPOSE_UNICODE' + libgit_c_args += '-DPROTECT_HFS_DEFAULT' +endif + +# Configure general compatibility wrappers. +if host_machine.system() == 'cygwin' + libgit_sources += [ + 'compat/win32/path-utils.c', + ] +elif host_machine.system() == 'windows' + libgit_sources += [ + 'compat/mingw.c', + 'compat/winansi.c', + 'compat/win32/flush.c', + 'compat/win32/path-utils.c', + 'compat/win32/pthread.c', + 'compat/win32/syslog.c', + 'compat/win32/dirent.c', + 'compat/win32mmap.c', + 'compat/nedmalloc/nedmalloc.c', + ] + + libgit_c_args += [ + '-DDETECT_MSYS_TTY', + '-DENSURE_MSYSTEM_IS_SET', + '-DNATIVE_CRLF', + '-DNOGDI', + '-DNO_POSIX_GOODIES', + '-DWIN32', + '-D_CONSOLE', + '-D_CONSOLE_DETECT_MSYS_TTY', + '-D__USE_MINGW_ANSI_STDIO=0', + ] + + libgit_dependencies += compiler.find_library('ntdll') + libgit_include_directories += 'compat/win32' + if compiler.get_id() == 'msvc' + libgit_include_directories += 'compat/vcbuild/include' + endif +endif + +if host_machine.system() == 'linux' + libgit_sources += 'compat/linux/procinfo.c' +elif host_machine.system() == 'windows' + libgit_sources += 'compat/win32/trace2_win32_process_info.c' +else + libgit_sources += 'compat/stub/procinfo.c' +endif + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + libgit_c_args += [ + '-DUNRELIABLE_FSTAT', + '-DMMAP_PREVENTS_DELETE', + '-DOBJECT_CREATION_MODE=1', + ] +endif + +# Configure the simple-ipc subsystem required fro the fsmonitor. +if host_machine.system() == 'windows' + libgit_sources += [ + 'compat/simple-ipc/ipc-shared.c', + 'compat/simple-ipc/ipc-win32.c', + ] + libgit_c_args += '-DSUPPORTS_SIMPLE_IPC' +else + libgit_sources += [ + 'compat/simple-ipc/ipc-shared.c', + 'compat/simple-ipc/ipc-unix-socket.c', + ] + libgit_c_args += '-DSUPPORTS_SIMPLE_IPC' +endif + +fsmonitor_backend = '' +if host_machine.system() == 'windows' + fsmonitor_backend = 'win32' +elif host_machine.system() == 'darwin' + fsmonitor_backend = 'darwin' + libgit_dependencies += dependency('CoreServices') +endif +if fsmonitor_backend != '' + libgit_c_args += '-DHAVE_FSMONITOR_DAEMON_BACKEND' + libgit_c_args += '-DHAVE_FSMONITOR_OS_SETTINGS' + + libgit_sources += [ + 'compat/fsmonitor/fsm-health-' + fsmonitor_backend + '.c', + 'compat/fsmonitor/fsm-ipc-' + fsmonitor_backend + '.c', + 'compat/fsmonitor/fsm-listen-' + fsmonitor_backend + '.c', + 'compat/fsmonitor/fsm-path-utils-' + fsmonitor_backend + '.c', + 'compat/fsmonitor/fsm-settings-' + fsmonitor_backend + '.c', + ] +endif +build_options_config.set_quoted('FSMONITOR_DAEMON_BACKEND', fsmonitor_backend) +build_options_config.set_quoted('FSMONITOR_OS_SETTINGS', fsmonitor_backend) + +if compiler.has_header('regex.h') and compiler.get_define('REG_STARTEND', prefix: '#include ') != '' + build_options_config.set('NO_REGEX', '') + + if compiler.get_define('REG_ENHANCED', prefix: '#include ') != '' + libgit_c_args += '-DUSE_ENHANCED_BASIC_REGULAR_EXPRESSIONS' + libgit_sources += 'compat/regcomp_enhanced.c' + endif +else + libgit_c_args += [ + '-DNO_REGEX', + '-DGAWK', + '-DNO_MBSUPPORT', + ] + build_options_config.set('NO_REGEX', '1') + libgit_sources += 'compat/regex/regex.c' + libgit_include_directories += 'compat/regex' +endif + +# setitimer and friends are provided by compat/mingw.c. +if host_machine.system() != 'windows' + if not compiler.compiles(''' + #include + void func(void) + { + struct itimerval value; + } + ''', name: 'struct itimerval') + libgit_c_args += '-DNO_STRUCT_ITIMERVAL' + libgit_c_args += '-DNO_SETITIMER' + elif not compiler.has_function('setitimer') + libgit_c_args += '-DNO_SETITIMER' + endif +endif + +if compiler.has_member('struct stat', 'st_mtimespec.tv_nsec', prefix: '#include ') + libgit_c_args += '-DUSE_ST_TIMESPEC' +elif not compiler.has_member('struct stat', 'st_mtim.tv_nsec', prefix: '#include ') + libgit_c_args += '-DNO_NSEC' +endif + +if not compiler.has_member('struct stat', 'st_blocks', prefix: '#include ') + libgit_c_args += '-DNO_ST_BLOCKS_IN_STRUCT_STAT' +endif + +if not compiler.has_member('struct dirent', 'd_type', prefix: '#include ') + libgit_c_args += '-DNO_D_TYPE_IN_DIRENT' +endif + +if not compiler.has_member('struct passwd', 'pw_gecos', prefix: '#include ') + libgit_c_args += '-DNO_GECOS_IN_PWENT' +endif + +if compiler.has_function('sync_file_range') + libgit_c_args += '-DHAVE_SYNC_FILE_RANGE' +endif + +if not compiler.has_function('strcasestr') + libgit_c_args += '-DNO_STRCASESTR' + libgit_sources += 'compat/strcasestr.c' +endif + +if not compiler.has_function('memmem') + libgit_c_args += '-DNO_MEMMEM' + libgit_sources += 'compat/memmem.c' +endif + +if not compiler.has_function('strlcpy') + libgit_c_args += '-DNO_STRLCPY' + libgit_sources += 'compat/strlcpy.c' +endif + +if not compiler.has_function('strdup') + libgit_c_args += '-DOVERRIDE_STRDUP' + libgit_sources += 'compat/strdup.c' +endif + +if not compiler.has_function('strtoumax') + libgit_c_args += '-DNO_STRTOUMAX' + libgit_sources += [ + 'compat/strtoumax.c', + 'compat/strtoimax.c', + ] +endif + +if not compiler.has_function('strtoull') + libgit_c_args += '-DNO_STRTOULL' +endif + +if not compiler.has_function('setenv') + libgit_c_args += '-DNO_SETENV' + libgit_sources += 'compat/setenv.c' +endif + +if not compiler.has_function('qsort') + libgit_c_args += '-DINTERNAL_QSORT' +endif +libgit_sources += 'compat/qsort_s.c' + +# unsetenv is provided by compat/mingw.c. +if host_machine.system() != 'windows' and not compiler.has_function('unsetenv') + libgit_c_args += '-DNO_UNSETENV' + libgit_sources += 'compat/unsetenv.c' +endif + +if not compiler.has_function('mkdtemp') + libgit_c_args += '-DNO_MKDTEMP' + libgit_sources += 'compat/mkdtemp.c' +endif + +if not compiler.has_function('initgroups') + libgit_c_args += '-DNO_INITGROUPS' +endif + +if compiler.has_function('getdelim') + libgit_c_args += '-DHAVE_GETDELIM' +endif + +if host_machine.system() == 'windows' + libgit_c_args += '-DUSE_WIN32_MMAP' +elif not compiler.has_function('mmap') + libgit_c_args += '-DNO_MMAP' + libgit_sources += 'compat/mmap.c' +endif + +if compiler.has_function('clock_gettime') + libgit_c_args += '-DHAVE_CLOCK_GETTIME' +endif + +if compiler.compiles(''' + #include + + void func(void) + { + clockid_t id = CLOCK_MONOTONIC; + } +''', name: 'monotonic clock') + libgit_c_args += '-DHAVE_CLOCK_MONOTONIC' +endif + +if compiler.compiles(''' + #include + + void func(void) + { + uintmax_t x = 0; + } +''', name: 'uintmax_t') + libgit_c_args += '-DNO_UINTMAX_T' +endif + +has_bsd_sysctl = false +if compiler.has_header('sys/sysctl.h') + if compiler.compiles(''' + #include + #include + + void func(void) + { + int val, mib[2] = { 0 }; + size_t len = sizeof(val); + sysctl(mib, 2, &val, &len, NULL, 0); + } + ''', name: 'BSD sysctl') + libgit_c_args += '-DHAVE_BSD_SYSCTL' + has_bsd_sysctl = true + endif +endif + +if compiler.run(''' + #include + + int main(int argc, const char **argv) + { + FILE *f = fopen(".", "r"); + return f ? 0 : 1; + } +''', name: 'fread reads directories').returncode() == 0 + libgit_c_args += '-DFREAD_READS_DIRECTORIES' + libgit_sources += 'compat/fopen.c' +endif + +if not meson.is_cross_build() and fs.exists('/dev/tty') + libgit_c_args += '-DHAVE_DEV_TTY' +endif + +if get_option('openssl').enabled() and get_option('CommonCrypto').enabled() + error('Can only use one SSL backend') +endif + +security_framework = dependency('Security', required: get_option('CommonCrypto').disable_auto_if(host_machine.system() != 'darwin')) +core_foundation_framework = dependency('CoreFoundation', required: security_framework.found()) +if security_framework.found() + libgit_dependencies += security_framework + libgit_dependencies += core_foundation_framework + libgit_c_args += '-DAPPLE_COMMON_CRYPTO' +endif + +# OpenSSL is required when requested via the 'openssl' feature or via one of +# the SHA1/SHA256 backends. +openssl_required = get_option('openssl').disable_auto_if(security_framework.found()) +if get_option('sha1_backend') == 'openssl' or get_option('sha256_backend') == 'openssl' + openssl_required = true +endif + +openssl = dependency('openssl', required: openssl_required, default_options: ['default_library=static']) +if openssl.found() + libgit_dependencies += openssl +endif + +# We may not want to use OpenSSL for anything but our SHA1/SHA256 backends, so +# we cannot just set NO_OPENSSL based on whether or not the library was found. +if not openssl.found() or get_option('openssl').disabled() + libgit_c_args += '-DNO_OPENSSL' +endif + +sha1_backend = get_option('sha1_backend') +if sha1_backend == 'sha1dc' + libgit_c_args += '-DSHA1_DC' + libgit_c_args += '-DSHA1DC_NO_STANDARD_INCLUDES=1' + libgit_c_args += '-DSHA1DC_INIT_SAFE_HASH_DEFAULT=0' + libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="git-compat-util.h"' + libgit_c_args += '-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="git-compat-util.h"' + + libgit_sources += [ + 'sha1dc_git.c', + 'sha1dc/sha1.c', + 'sha1dc/ubc_check.c', + ] +elif sha1_backend == 'common-crypto' + libgit_c_args += '-DCOMMON_DIGEST_FOR_OPENSSL' + libgit_c_args += '-DSHA1_APPLE' + libgit_c_args += '-DSHA1_MAX_BLOCK_SIZE=1024L*1024L*1024L' +elif sha1_backend == 'openssl' + if not openssl.found() + openssl = dependency('openssl', required: true) + endif + + libgit_c_args += '-DSHA1_OPENSSL' + # Apple CommonCrypto requires chunking +elif sha1_backend == 'block' + libgit_c_args += '-DSHA1_BLK' + libgit_sources += 'block-sha1/sha1.c' +else + error('Unhandled SHA1 backend ' + sha1_backend) +endif + +sha256_backend = get_option('sha256_backend') +if sha256_backend == 'openssl' + libgit_c_args += '-DSHA256_OPENSSL' +elif sha256_backend == 'nettle' + nettle = dependency('nettle') + libgit_dependencies += nettle + libgit_c_args += '-DSHA256_NETTLE' +elif sha256_backend == 'gcrypt' + gcrypt = dependency('gcrypt') + libgit_dependencies += gcrypt + libgit_c_args += '-DSHA256_GCRYPT' +elif sha256_backend == 'block' + libgit_c_args += '-DSHA256_BLK' + libgit_sources += 'sha256/block/sha256.c' +else + error('Unhandled SHA256 backend ' + sha256_backend) +endif + +if compiler.has_header_symbol('stdlib.h', 'arc4random_buf') + libgit_c_args += '-DHAVE_ARC4RANDOM' +elif compiler.has_header_symbol('bsd/stdlib.h', 'arc4random_buf') + libgit_c_args += '-DHAVE_ARC4RANDOM_BSD' +elif compiler.has_function('getrandom', prefix: '#include ') + libgit_c_args += '-DHAVE_GETRANDOM' +elif compiler.has_function('getentropy', prefix: '#include ') + libgit_c_args += '-DHAVE_GETENTROPY' +elif compiler.has_function('RtlGenRandom', prefix: '#include \n#include ') + libgit_c_args += '-DHAVE_RTLGENRANDOM' +elif openssl.found() + libgit_c_args += '-DHAVE_OPENSSL_CSPRNG' +endif + +if get_option('runtime_prefix') + libgit_c_args += '-DRUNTIME_PREFIX' + build_options_config.set('RUNTIME_PREFIX', '1') + + if compiler.has_header('mach-o/dyld.h') + libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH' + endif + + if has_bsd_sysctl and compiler.compiles(''' + #include + + void func(void) + { + KERN_PROC_PATHNAME; KERN_PROC; + } + ''', name: 'BSD KERN_PROC_PATHNAME') + libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH' + endif + + if host_machine.system() == 'linux' + libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe' + '"' + elif host_machine.system() == 'openbsd' + libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/file' + '"' + elif host_machine.system() == 'netbsd' + libgit_c_args += '-DPROCFS_EXECUTABLE_PATH="' + '/proc/curproc/exe' + '"' + endif + + if host_machine.system() == 'windows' and compiler.compiles(''' + #include + + void func(void) + { + _wpgmptr; + } + ''', name: 'Win32 _wpgmptr') + libgit_c_args += '-DHAVE_WPGMPTR' + endif +else + build_options_config.set('RUNTIME_PREFIX', '') +endif + +foreach key, value : { + 'DIFF': diff.full_path(), + 'GIT_TEST_CMP': diff.full_path() + ' -u', + 'GIT_TEST_GITPERLLIB': meson.project_build_root() / 'perl', + 'GIT_TEST_MERGE_TOOLS_DIR': meson.project_source_root() / 'mergetools', + 'GIT_TEST_POPATH': meson.project_source_root() / 'po', + 'GIT_TEST_TEMPLATE_DIR': meson.project_build_root() / 'templates', + 'GIT_TEST_TEXTDOMAINDIR': meson.project_build_root() / 'po', + 'PAGER_ENV': get_option('pager_environment'), + 'PERL_PATH': perl.found() ? perl.full_path() : '', + 'PYTHON_PATH': python.found () ? python.full_path() : '', + 'SHELL_PATH': shell.full_path(), + 'TAR': tar.full_path(), + 'TEST_OUTPUT_DIRECTORY': test_output_directory, + 'TEST_SHELL_PATH': shell.full_path(), +} + if value != '' and cygpath.found() + value = run_command(cygpath, value, check: true).stdout().strip() + endif + build_options_config.set_quoted(key, value) +endforeach + +configure_file( + input: 'GIT-BUILD-OPTIONS.in', + output: 'GIT-BUILD-OPTIONS', + configuration: build_options_config, +) + +# Build a separate library for "version.c" so that we do not have to rebuild +# everything when the current Git commit changes. TODO: this only gets set up +# at configuration time, so we do not notice version changes unless the build +# instructions get regenerated. We should refactor the source file such that we +# can substitute tags in the file via `vcs_tag()`. +libgit_version_library = static_library('git-version', + sources: ['version.c'], + c_args: libgit_c_args + [ + '-DGIT_VERSION="' + meson.project_version() + '"', + '-DGIT_USER_AGENT="' + 'git/' + meson.project_version() + '"', + '-DGIT_BUILT_FROM_COMMIT="' + run_command('git', 'rev-parse', '-q', '--verify', 'HEAD', check: false).stdout().strip() + '"', + ], + dependencies: libgit_dependencies, + include_directories: libgit_include_directories, +) + +libgit_library = static_library('git', + sources: libgit_sources, + c_args: libgit_c_args, + link_with: libgit_version_library, + dependencies: libgit_dependencies, + include_directories: libgit_include_directories, +) + +libgit = declare_dependency( + compile_args: libgit_c_args, + link_with: libgit_library, + dependencies: libgit_dependencies, + include_directories: libgit_include_directories, +) + +common_main_sources = ['common-main.c'] +common_main_link_args = [ ] +if host_machine.system() == 'windows' + # TODO: wire these up properly. + common_main_sources += import('windows').compile_resources('git.rc', args: [ + '-DMAJOR=1', + '-DMINOR=1', + '-DMICRO=1', + '-DPATCHLEVEL=0', + '-DGIT_VERSION=\\\"' + meson.project_version() + '.GIT\\\"', + ]) + if compiler.get_argument_syntax() == 'gcc' + common_main_link_args += [ + '-municode', + '-Wl,-nxcompat', + '-Wl,-dynamicbase', + '-Wl,-pic-executable,-e,mainCRTStartup', + ] + elif compiler.get_argument_syntax() == 'msvc' + common_main_link_args += [ + '/ENTRY:wmainCRTStartup', + 'invalidcontinue.obj', + ] + else + error('Unsupported compiler ' + compiler.get_id()) + endif +endif +common_main_library = static_library('common-main', + sources: common_main_sources, + c_args: libgit_c_args, + dependencies: libgit_dependencies, + include_directories: libgit_include_directories, +) +common_main = declare_dependency( + link_with: common_main_library, + link_args: common_main_link_args, +) + +bin_wrappers = [ ] +test_dependencies = [ ] + +git = executable('git', + sources: builtin_sources + 'git.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) +bin_wrappers += git + +test_dependencies += executable('git-daemon', + sources: 'daemon.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +test_dependencies += executable('git-sh-i18n--envsubst', + sources: 'sh-i18n--envsubst.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +bin_wrappers += executable('git-shell', + sources: 'shell.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +test_dependencies += executable('git-http-backend', + sources: 'http-backend.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +bin_wrappers += executable('scalar', + sources: 'scalar.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +if get_option('curl').enabled() + curl_sources = [ + 'http.c', + 'http-walker.c', + ] + + git_remote_http = executable('git-remote-http', + sources: curl_sources + 'remote-curl.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) + test_dependencies += git_remote_http + + test_dependencies += executable('git-http-fetch', + sources: curl_sources + 'http-fetch.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) + + if expat.found() + test_dependencies += executable('git-http-push', + sources: curl_sources + 'http-push.c', + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) + endif + + foreach alias : [ 'git-remote-https', 'git-remote-ftp', 'git-remote-ftps' ] + test_dependencies += executable(alias, + objects: git_remote_http.extract_all_objects(recursive: false), + dependencies: [libgit, common_main], + ) + + install_symlink(alias + executable_suffix, + install_dir: get_option('libexecdir') / 'git-core', + pointing_to: 'git-remote-http', + ) + endforeach +endif + +imap_send_sources = ['imap-send.c'] +if use_curl_for_imap_send + imap_send_sources += curl_sources +endif + +test_dependencies += executable('git-imap-send', + sources: imap_send_sources, + dependencies: [libgit, common_main], + install: true, + install_dir: get_option('libexecdir') / 'git-core', +) + +foreach alias : [ 'git-receive-pack', 'git-upload-archive', 'git-upload-pack' ] + bin_wrappers += executable(alias, + objects: git.extract_all_objects(recursive: false), + dependencies: [libgit, common_main], + ) + + install_symlink(alias + executable_suffix, + install_dir: get_option('libexecdir') / 'git-core', + pointing_to: 'git-remote-http', + ) +endforeach + +foreach symlink : [ + 'git', + 'git-http-backend', + 'git-receive-pack', + 'git-shell', + 'git-upload-archive', + 'git-upload-pack', + 'scalar', +] + install_symlink(symlink, + install_dir: get_option('bindir'), + pointing_to: fs.relative_to(get_option('libexecdir') / 'git-core' / symlink, get_option('bindir')), + ) +endforeach + +script_sh_config = configuration_data() +script_sh_config.set('BROKEN_PATH_FIX', '') +script_sh_config.set('DIFF', fs.as_posix(diff.full_path())) +script_sh_config.set('PAGER_ENV', get_option('pager_environment')) +script_sh_config.set('PERL_PATH', perl.found() ? fs.as_posix(perl.full_path()) : '') +script_sh_config.set('SHELL_PATH', fs.as_posix(shell.full_path())) +script_sh_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir'))) +if intl.found() + script_sh_config.set('USE_GETTEXT_SCHEME', '') +else + script_sh_config.set('USE_GETTEXT_SCHEME', 'fallthrough') +endif +script_sh_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb')) + +scripts_sh = [ + 'git-difftool--helper.sh', + 'git-filter-branch.sh', + 'git-merge-octopus.sh', + 'git-merge-one-file.sh', + 'git-merge-resolve.sh', + 'git-mergetool.sh', + 'git-quiltimport.sh', + 'git-request-pull.sh', + 'git-submodule.sh', + 'git-web--browse.sh', +] + +if perl_features_enabled + scripts_sh += 'git-instaweb.sh' +endif + +foreach script : scripts_sh + configure_file( + input: script, + output: fs.stem(script), + configuration: script_sh_config, + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) +endforeach + +scripts_lib = [ + 'git-mergetool--lib.sh', + 'git-sh-i18n.sh', + 'git-sh-setup.sh', +] + +foreach script : scripts_lib + configure_file( + input: script, + output: fs.stem(script), + configuration: script_sh_config, + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) +endforeach + +if perl_features_enabled + scripts_perl = [ + 'git-archimport.perl', + 'git-cvsexportcommit.perl', + 'git-cvsimport.perl', + 'git-cvsserver.perl', + 'git-send-email.perl', + 'git-svn.perl', + ] + + pathsep = ':' + if host_machine.system() == 'windows' + pathsep = ';' + endif + + perl_header_template = 'perl/header_templates/fixed_prefix.template.pl' + if get_option('runtime_prefix') + perl_header_template = 'perl/header_templates/runtime_prefix.template.pl' + endif + + perl_header = configure_file( + input: perl_header_template, + output: 'GIT-PERL-HEADER', + configuration: { + 'GITEXECDIR_REL': get_option('libexecdir') / 'git-core', + 'PERLLIBDIR_REL': get_option('datadir') / 'perl5', + 'LOCALEDIR_REL': get_option('datadir') / 'locale', + 'INSTLIBDIR': get_option('datadir') / 'perl5', + 'PATHSEP': pathsep, + }, + ) + + foreach script : scripts_perl + generated_script = custom_target(script, + input: script, + output: fs.stem(script), + command: [ + shell, + meson.project_source_root() / 'generate-perl.sh', + meson.project_version(), + perl_header, + perl.full_path(), + '@INPUT@', + '@OUTPUT@', + ], + install: true, + install_dir: get_option('datadir') / 'perl5', + ) + test_dependencies += generated_script + if script == 'git-cvsserver.perl' + bin_wrappers += generated_script + endif + endforeach + + subdir('perl') +endif + +if python.found() + scripts_python = [ + 'git-p4.py' + ] + + foreach script : scripts_python + fs.copyfile(script, fs.stem(script), + install: true, + install_dir: get_option('libexecdir') / 'git-core', + ) + endforeach +endif + +mergetools = [ + 'mergetools/araxis', + 'mergetools/bc', + 'mergetools/codecompare', + 'mergetools/deltawalker', + 'mergetools/diffmerge', + 'mergetools/diffuse', + 'mergetools/ecmerge', + 'mergetools/emerge', + 'mergetools/examdiff', + 'mergetools/guiffy', + 'mergetools/gvimdiff', + 'mergetools/kdiff3', + 'mergetools/kompare', + 'mergetools/meld', + 'mergetools/nvimdiff', + 'mergetools/opendiff', + 'mergetools/p4merge', + 'mergetools/smerge', + 'mergetools/tkdiff', + 'mergetools/tortoisemerge', + 'mergetools/vimdiff', + 'mergetools/vscode', + 'mergetools/winmerge', + 'mergetools/xxdiff', +] + +foreach mergetool : mergetools + install_data(mergetool, install_dir: get_option('libexecdir') / 'git-core' / 'mergetools') +endforeach + +if intl.found() + subdir('po') +endif +subdir('contrib') +subdir('gitweb') +subdir('templates') + +# Everything but the bin-wrappers need to come before this target such that we +# can properly set up test dependencies. The bin-wrappers themselves are set up +# at configuration time, so these are fine. +if get_option('tests') + subdir('t') +endif + +subdir('bin-wrappers') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000000..22e85a1756e --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,70 @@ +option('default_help_format', type: 'combo', choices: ['man', 'html', 'info'], value: 'man', + description: 'Format of installed documentation.') +option('default_pager', type: 'string', value: 'less', + description: 'Fall-back pager.') +option('default_editor', type: 'string', value: 'vi', + description: 'Fall-back editor.') +option('gitconfig', type: 'string', value: '/etc/gitconfig', + description: 'Path to the global git configuration file.') +option('gitattributes', type: 'string', value: '/etc/gitattributes', + description: 'Path to the global git attributes file.') +option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c', + description: 'Environment used when spawning the pager') +option('runtime_prefix', type: 'boolean', value: false, + description: 'Resolve ancillary tooling and support files relative to the location of the runtime binary instead of hard-coding them into the binary.') + +option('curl', type: 'feature', value: 'enabled', + description: 'Build helpers used to access remotes with the HTTP transport.') +option('expat', type: 'feature', value: 'enabled', + description: 'Build helpers used to push to remotes with the HTTP transport.') +option('gettext', type: 'feature', value: 'enabled', + description: 'Build translation files.') +option('iconv', type: 'feature', value: 'enabled', + description: 'Support reencoding strings with different encodings.') +option('pcre2', type: 'feature', value: 'enabled', + description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).') +option('perl', type: 'feature', value: 'enabled', + description: 'Build tools written in Perl.') +option('perl_cpan_fallback', type: 'boolean', value: true, + description: 'Install bundled copies of CPAN modules that serve as a fallback in case the modules are not available on the system.') +option('python', type: 'feature', value: 'enabled', + description: 'Build tools written in Python.') + +option('openssl', type: 'feature', value: 'auto', + description: 'Support access to HTTPS remotes. OpenSSL may still be pulled in if configured as SHA1 or SHA256 backend.') +option('CommonCrypto', type: 'feature', value: 'auto', + description: 'Build tools written in Python.') + +option('sha1_backend', type: 'combo', choices: ['openssl', 'block', 'sha1dc', 'common-crypto'], value: 'sha1dc', + description: 'The backend used for hashing objects with the SHA1 object format') +option('sha256_backend', type: 'combo', choices: ['openssl', 'nettle', 'gcrypt', 'block'], value: 'block', + description: 'The backend used for hashing objects with the SHA256 object format') + +option('macos_use_homebrew_gettext', type: 'boolean', value: true, + description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.') + +option('gitweb_config', type: 'string', value: 'gitweb_config.perl') +option('gitweb_config_system', type: 'string', value: '/etc/gitweb.conf') +option('gitweb_config_common', type: 'string', value: '/etc/gitweb-common.conf') +option('gitweb_home_link_str', type: 'string', value: 'projects') +option('gitweb_sitename', type: 'string', value: '') +option('gitweb_projectroot', type: 'string', value: '/pub/git') +option('gitweb_project_maxdepth', type: 'string', value: '2007') +option('gitweb_export_ok', type: 'string', value: '') +option('gitweb_strict_export', type: 'string', value: '') +option('gitweb_base_url', type: 'string', value: '') +option('gitweb_list', type: 'string', value: '') +option('gitweb_hometext', type: 'string', value: 'indextext.html') +option('gitweb_css', type: 'string', value: 'static/gitweb.css') +option('gitweb_logo', type: 'string', value: 'static/git-logo.png') +option('gitweb_favicon', type: 'string', value: 'static/git-favicon.png') +option('gitweb_js', type: 'string', value: 'static/gitweb.js') +option('gitweb_site_html_head_string', type: 'string', value: '') +option('gitweb_site_header', type: 'string', value: '') +option('gitweb_site_footer', type: 'string', value: '') +option('highlight_bin', type: 'string', value: 'highlight') + +option('tests', type: 'boolean', value: true, + description: 'Enable building tests. This requires Perl, but is separate from the "perl" option such that you can build tests without Perl features enabled.') +option('test_output_directory', type: 'string', + description: 'Path to the directory used to store test outputs') diff --git a/perl/FromCPAN/Mail/meson.build b/perl/FromCPAN/Mail/meson.build new file mode 100644 index 00000000000..8cbd90ce184 --- /dev/null +++ b/perl/FromCPAN/Mail/meson.build @@ -0,0 +1,7 @@ +configure_file( + input: 'Address.pm', + output: 'Address.pm', + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/FromCPAN/Mail', +) diff --git a/perl/FromCPAN/meson.build b/perl/FromCPAN/meson.build new file mode 100644 index 00000000000..ff88b35c2ca --- /dev/null +++ b/perl/FromCPAN/meson.build @@ -0,0 +1,9 @@ +configure_file( + input: 'Error.pm', + output: 'Error.pm', + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/FromCPAN', +) + +subdir('Mail') diff --git a/perl/Git/LoadCPAN/Mail/meson.build b/perl/Git/LoadCPAN/Mail/meson.build new file mode 100644 index 00000000000..fbf324307bf --- /dev/null +++ b/perl/Git/LoadCPAN/Mail/meson.build @@ -0,0 +1,7 @@ +configure_file( + input: 'Address.pm', + output: 'Address.pm', + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN/Mail', +) diff --git a/perl/Git/LoadCPAN/meson.build b/perl/Git/LoadCPAN/meson.build new file mode 100644 index 00000000000..542e1082252 --- /dev/null +++ b/perl/Git/LoadCPAN/meson.build @@ -0,0 +1,9 @@ +configure_file( + input: 'Error.pm', + output: 'Error.pm', + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/LoadCPAN', +) + +subdir('Mail') diff --git a/perl/Git/SVN/Memoize/meson.build b/perl/Git/SVN/Memoize/meson.build new file mode 100644 index 00000000000..727375c8337 --- /dev/null +++ b/perl/Git/SVN/Memoize/meson.build @@ -0,0 +1,7 @@ +configure_file( + input: 'YAML.pm', + output: 'YAML.pm', + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/SVN', +) diff --git a/perl/Git/SVN/meson.build b/perl/Git/SVN/meson.build new file mode 100644 index 00000000000..eccc3f2263d --- /dev/null +++ b/perl/Git/SVN/meson.build @@ -0,0 +1,20 @@ +foreach source : [ + 'Editor.pm', + 'Fetcher.pm', + 'GlobSpec.pm', + 'Log.pm', + 'Migration.pm', + 'Prompt.pm', + 'Ra.pm', + 'Utils.pm', +] + configure_file( + input: source, + output: source, + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/Git/SVN', + ) +endforeach + +subdir('Memoize') diff --git a/perl/Git/meson.build b/perl/Git/meson.build new file mode 100644 index 00000000000..97bd62290d2 --- /dev/null +++ b/perl/Git/meson.build @@ -0,0 +1,18 @@ +foreach source : [ + 'I18N.pm', + 'IndexInfo.pm', + 'LoadCPAN.pm', + 'Packet.pm', + 'SVN.pm', +] + configure_file( + input: source, + output: source, + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5/Git', + ) +endforeach + +subdir('LoadCPAN') +subdir('SVN') diff --git a/perl/meson.build b/perl/meson.build new file mode 100644 index 00000000000..0a7bf41d5b9 --- /dev/null +++ b/perl/meson.build @@ -0,0 +1,18 @@ +perl_config = { + 'LOCALEDIR': get_option('prefix') / get_option('datadir') / 'locale', + 'NO_GETTEXT': iconv.found() ? '' : '1', + 'NO_PERL_CPAN_FALLBACKS': get_option('perl_cpan_fallback') ? '' : '1', +} + +configure_file( + input: 'Git.pm', + output: 'Git.pm', + configuration: perl_config, + install: true, + install_dir: get_option('datadir') / 'perl5', +) + +subdir('Git') +if get_option('perl_cpan_fallback') + subdir('FromCPAN') +endif diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000000..fb1b92eb0a2 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,28 @@ +i18n = import('i18n') + +translations = i18n.gettext('git', + languages: [ + 'bg', + 'ca', + 'de', + 'el', + 'es', + 'fr', + 'id', + 'is', + 'it', + 'ko', + 'pl', + 'pt_PT', + 'ru', + 'sv', + 'tr', + 'uk', + 'vi', + 'zh_CN', + 'zh_TW', + ], + install: true, + install_dir: get_option('datadir'), +) +test_dependencies += translations[0] diff --git a/subprojects/curl.wrap b/subprojects/curl.wrap new file mode 100644 index 00000000000..f7e384b85cf --- /dev/null +++ b/subprojects/curl.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = curl-8.10.1 +source_url = https://github.com/curl/curl/releases/download/curl-8_10_1/curl-8.10.1.tar.xz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/curl_8.10.1-1/curl-8.10.1.tar.xz +source_filename = curl-8.10.1.tar.xz +source_hash = 73a4b0e99596a09fa5924a4fb7e4b995a85fda0d18a2c02ab9cf134bebce04ee +patch_filename = curl_8.10.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/curl_8.10.1-1/get_patch +patch_hash = 707c28f35fc9b0e8d68c0c2800712007612f922a31da9637ce706a2159f3ddd8 +wrapdb_version = 8.10.1-1 + +[provide] +dependency_names = libcurl diff --git a/subprojects/expat.wrap b/subprojects/expat.wrap new file mode 100644 index 00000000000..2e0427dcfd1 --- /dev/null +++ b/subprojects/expat.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = expat-2.6.3 +source_url = https://github.com/libexpat/libexpat/releases/download/R_2_6_3/expat-2.6.3.tar.xz +source_filename = expat-2.6.3.tar.bz2 +source_hash = 274db254a6979bde5aad404763a704956940e465843f2a9bd9ed7af22e2c0efc +patch_filename = expat_2.6.3-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/expat_2.6.3-1/get_patch +patch_hash = cf017fbe105e31428b2768360bd9be39094df4e948a1e8d1c54b6f7c76460cb1 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/expat_2.6.3-1/expat-2.6.3.tar.bz2 +wrapdb_version = 2.6.3-1 + +[provide] +expat = expat_dep diff --git a/subprojects/openssl.wrap b/subprojects/openssl.wrap new file mode 100644 index 00000000000..873d55106e9 --- /dev/null +++ b/subprojects/openssl.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = openssl-3.0.8 +source_url = https://www.openssl.org/source/openssl-3.0.8.tar.gz +source_filename = openssl-3.0.8.tar.gz +source_hash = 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e +patch_filename = openssl_3.0.8-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/openssl_3.0.8-3/get_patch +patch_hash = 300da189e106942347d61a4a4295aa2edbcf06184f8d13b4cee0bed9fb936963 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/openssl_3.0.8-3/openssl-3.0.8.tar.gz +wrapdb_version = 3.0.8-3 + +[provide] +libcrypto = libcrypto_dep +libssl = libssl_dep +openssl = openssl_dep diff --git a/subprojects/pcre2.wrap b/subprojects/pcre2.wrap new file mode 100644 index 00000000000..7e184472543 --- /dev/null +++ b/subprojects/pcre2.wrap @@ -0,0 +1,16 @@ +[wrap-file] +directory = pcre2-10.44 +source_url = https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.tar.bz2 +source_filename = pcre2-10.44.tar.bz2 +source_hash = d34f02e113cf7193a1ebf2770d3ac527088d485d4e047ed10e5d217c6ef5de96 +patch_filename = pcre2_10.44-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/pcre2_10.44-2/get_patch +patch_hash = 4336d422ee9043847e5e10dbbbd01940d4c9e5027f31ccdc33a7898a1ca94009 +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/pcre2_10.44-2/pcre2-10.44.tar.bz2 +wrapdb_version = 10.44-2 + +[provide] +libpcre2-8 = libpcre2_8 +libpcre2-16 = libpcre2_16 +libpcre2-32 = libpcre2_32 +libpcre2-posix = libpcre2_posix diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap new file mode 100644 index 00000000000..aa14de17740 --- /dev/null +++ b/subprojects/zlib.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = zlib-1.3.1 +source_url = http://zlib.net/fossils/zlib-1.3.1.tar.gz +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3.1-1/zlib-1.3.1.tar.gz +source_filename = zlib-1.3.1.tar.gz +source_hash = 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 +patch_filename = zlib_1.3.1-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3.1-1/get_patch +patch_hash = e79b98eb24a75392009cec6f99ca5cdca9881ff20bfa174e8b8926d5c7a47095 +wrapdb_version = 1.3.1-1 + +[provide] +zlib = zlib_dep diff --git a/t/helper/meson.build b/t/helper/meson.build new file mode 100644 index 00000000000..5e83884246e --- /dev/null +++ b/t/helper/meson.build @@ -0,0 +1,91 @@ +test_tool_sources = [ + '../unit-tests/test-lib.c', + 'test-advise.c', + 'test-bitmap.c', + 'test-bloom.c', + 'test-bundle-uri.c', + 'test-cache-tree.c', + 'test-chmtime.c', + 'test-config.c', + 'test-crontab.c', + 'test-csprng.c', + 'test-date.c', + 'test-delete-gpgsig.c', + 'test-delta.c', + 'test-dir-iterator.c', + 'test-drop-caches.c', + 'test-dump-cache-tree.c', + 'test-dump-fsmonitor.c', + 'test-dump-split-index.c', + 'test-dump-untracked-cache.c', + 'test-env-helper.c', + 'test-example-tap.c', + 'test-find-pack.c', + 'test-fsmonitor-client.c', + 'test-genrandom.c', + 'test-genzeros.c', + 'test-getcwd.c', + 'test-hash-speed.c', + 'test-hash.c', + 'test-hashmap.c', + 'test-hexdump.c', + 'test-json-writer.c', + 'test-lazy-init-name-hash.c', + 'test-match-trees.c', + 'test-mergesort.c', + 'test-mktemp.c', + 'test-online-cpus.c', + 'test-pack-mtimes.c', + 'test-parse-options.c', + 'test-parse-pathspec-file.c', + 'test-partial-clone.c', + 'test-path-utils.c', + 'test-pcre2-config.c', + 'test-pkt-line.c', + 'test-proc-receive.c', + 'test-progress.c', + 'test-reach.c', + 'test-read-cache.c', + 'test-read-graph.c', + 'test-read-midx.c', + 'test-ref-store.c', + 'test-reftable.c', + 'test-regex.c', + 'test-repository.c', + 'test-revision-walking.c', + 'test-rot13-filter.c', + 'test-run-command.c', + 'test-scrap-cache-tree.c', + 'test-serve-v2.c', + 'test-sha1.c', + 'test-sha256.c', + 'test-sigchain.c', + 'test-simple-ipc.c', + 'test-string-list.c', + 'test-submodule-config.c', + 'test-submodule-nested-repo-config.c', + 'test-submodule.c', + 'test-subprocess.c', + 'test-tool.c', + 'test-trace2.c', + 'test-truncate.c', + 'test-userdiff.c', + 'test-wildmatch.c', + 'test-windows-named-pipe.c', + 'test-write-cache.c', + 'test-xml-encode.c', +] + +test_tool = executable('test-tool', + sources: test_tool_sources, + dependencies: [libgit, common_main], +) +bin_wrappers += test_tool +test_dependencies += test_tool + +test_fake_ssh = executable('test-fake-ssh', + sources: 'test-fake-ssh.c', + dependencies: [libgit, common_main], +) +bin_wrappers += test_fake_ssh +test_dependencies += test_fake_ssh diff --git a/t/meson.build b/t/meson.build new file mode 100644 index 00000000000..8b1627e9164 --- /dev/null +++ b/t/meson.build @@ -0,0 +1,1105 @@ +awk = find_program('awk') + +clar_test_suites = [ + 'unit-tests/ctype.c', + 'unit-tests/strvec.c', +] + +clar_sources = [ + 'unit-tests/clar/clar.c', + 'unit-tests/unit-test.c', +] + +clar_decls_h = custom_target('clar_decls_h', + input: clar_test_suites, + output: 'clar-decls.h', + command : [shell, meson.current_source_dir() + '/unit-tests/generate-clar-decls.sh', '@OUTPUT@', '@INPUT@'], + env: script_environment, +) +clar_sources += clar_decls_h + +clar_sources += custom_target('clar_suite', + input: clar_decls_h, + output: 'clar.suite', + feed: true, + capture: true, + command : [awk, '-f', meson.current_source_dir() + '/unit-tests/clar-generate.awk'], +) + +clar_unit_tests = executable('unit-tests', + sources: clar_sources + clar_test_suites, + dependencies: [libgit, common_main], +) +test('unit-tests', clar_unit_tests) + +unit_test_programs = [ + 'unit-tests/t-example-decorate.c', + 'unit-tests/t-hash.c', + 'unit-tests/t-hashmap.c', + 'unit-tests/t-mem-pool.c', + 'unit-tests/t-oid-array.c', + 'unit-tests/t-oidmap.c', + 'unit-tests/t-oidtree.c', + 'unit-tests/t-prio-queue.c', + 'unit-tests/t-reftable-basics.c', + 'unit-tests/t-reftable-block.c', + 'unit-tests/t-reftable-merged.c', + 'unit-tests/t-reftable-pq.c', + 'unit-tests/t-reftable-readwrite.c', + 'unit-tests/t-reftable-record.c', + 'unit-tests/t-reftable-stack.c', + 'unit-tests/t-reftable-tree.c', + 'unit-tests/t-strbuf.c', + 'unit-tests/t-strcmp-offset.c', + 'unit-tests/t-trailer.c', + 'unit-tests/t-urlmatch-normalization.c', +] + +foreach unit_test_program : unit_test_programs + unit_test_name = fs.stem(unit_test_program) + unit_test = executable(unit_test_name, + sources: [ + 'unit-tests/test-lib.c', + 'unit-tests/lib-oid.c', + 'unit-tests/lib-reftable.c', + unit_test_program, + ], + dependencies: [libgit, common_main], + ) + test(unit_test_name, unit_test, + workdir: meson.current_source_dir(), + ) +endforeach + +subdir('helper') + +integration_tests = [ + 't0000-basic.sh', + 't0001-init.sh', + 't0002-gitfile.sh', + 't0003-attributes.sh', + 't0004-unwritable.sh', + 't0005-signals.sh', + 't0006-date.sh', + 't0007-git-var.sh', + 't0008-ignores.sh', + 't0010-racy-git.sh', + 't0012-help.sh', + 't0013-sha1dc.sh', + 't0014-alias.sh', + 't0017-env-helper.sh', + 't0018-advice.sh', + 't0019-json-writer.sh', + 't0020-crlf.sh', + 't0021-conversion.sh', + 't0022-crlf-rename.sh', + 't0023-crlf-am.sh', + 't0024-crlf-archive.sh', + 't0025-crlf-renormalize.sh', + 't0026-eol-config.sh', + 't0027-auto-crlf.sh', + 't0028-working-tree-encoding.sh', + 't0029-core-unsetenvvars.sh', + 't0030-stripspace.sh', + 't0033-safe-directory.sh', + 't0034-root-safe-directory.sh', + 't0035-safe-bare-repository.sh', + 't0040-parse-options.sh', + 't0041-usage.sh', + 't0050-filesystem.sh', + 't0051-windows-named-pipe.sh', + 't0052-simple-ipc.sh', + 't0055-beyond-symlinks.sh', + 't0056-git-C.sh', + 't0060-path-utils.sh', + 't0061-run-command.sh', + 't0062-revision-walking.sh', + 't0063-string-list.sh', + 't0066-dir-iterator.sh', + 't0067-parse_pathspec_file.sh', + 't0068-for-each-repo.sh', + 't0070-fundamental.sh', + 't0071-sort.sh', + 't0080-unit-test-output.sh', + 't0081-find-pack.sh', + 't0090-cache-tree.sh', + 't0091-bugreport.sh', + 't0092-diagnose.sh', + 't0095-bloom.sh', + 't0100-previous.sh', + 't0101-at-syntax.sh', + 't0200-gettext-basic.sh', + 't0201-gettext-fallbacks.sh', + 't0202-gettext-perl.sh', + 't0203-gettext-setlocale-sanity.sh', + 't0204-gettext-reencode-sanity.sh', + 't0210-trace2-normal.sh', + 't0211-trace2-perf.sh', + 't0212-trace2-event.sh', + 't0300-credentials.sh', + 't0301-credential-cache.sh', + 't0302-credential-store.sh', + 't0303-credential-external.sh', + 't0410-partial-clone.sh', + 't0411-clone-from-partial.sh', + 't0450-txt-doc-vs-help.sh', + 't0500-progress-display.sh', + 't0600-reffiles-backend.sh', + 't0601-reffiles-pack-refs.sh', + 't0602-reffiles-fsck.sh', + 't0610-reftable-basics.sh', + 't0611-reftable-httpd.sh', + 't0612-reftable-jgit-compatibility.sh', + 't0613-reftable-write-options.sh', + 't1000-read-tree-m-3way.sh', + 't1001-read-tree-m-2way.sh', + 't1002-read-tree-m-u-2way.sh', + 't1003-read-tree-prefix.sh', + 't1004-read-tree-m-u-wf.sh', + 't1005-read-tree-reset.sh', + 't1006-cat-file.sh', + 't1007-hash-object.sh', + 't1008-read-tree-overlay.sh', + 't1009-read-tree-new-index.sh', + 't1010-mktree.sh', + 't1011-read-tree-sparse-checkout.sh', + 't1012-read-tree-df.sh', + 't1013-read-tree-submodule.sh', + 't1014-read-tree-confusing.sh', + 't1015-read-index-unmerged.sh', + 't1016-compatObjectFormat.sh', + 't1020-subdirectory.sh', + 't1021-rerere-in-workdir.sh', + 't1022-read-tree-partial-clone.sh', + 't1050-large.sh', + 't1051-large-conversion.sh', + 't1060-object-corruption.sh', + 't1090-sparse-checkout-scope.sh', + 't1091-sparse-checkout-builtin.sh', + 't1092-sparse-checkout-compatibility.sh', + 't1100-commit-tree-options.sh', + 't1300-config.sh', + 't1301-shared-repo.sh', + 't1302-repo-version.sh', + 't1303-wacky-config.sh', + 't1304-default-acl.sh', + 't1305-config-include.sh', + 't1306-xdg-files.sh', + 't1307-config-blob.sh', + 't1308-config-set.sh', + 't1309-early-config.sh', + 't1310-config-default.sh', + 't1350-config-hooks-path.sh', + 't1400-update-ref.sh', + 't1401-symbolic-ref.sh', + 't1402-check-ref-format.sh', + 't1403-show-ref.sh', + 't1404-update-ref-errors.sh', + 't1405-main-ref-store.sh', + 't1406-submodule-ref-store.sh', + 't1407-worktree-ref-store.sh', + 't1408-packed-refs.sh', + 't1409-avoid-packing-refs.sh', + 't1410-reflog.sh', + 't1411-reflog-show.sh', + 't1412-reflog-loop.sh', + 't1413-reflog-detach.sh', + 't1414-reflog-walk.sh', + 't1415-worktree-refs.sh', + 't1416-ref-transaction-hooks.sh', + 't1417-reflog-updateref.sh', + 't1418-reflog-exists.sh', + 't1419-exclude-refs.sh', + 't1420-lost-found.sh', + 't1430-bad-ref-name.sh', + 't1450-fsck.sh', + 't1451-fsck-buffer.sh', + 't1460-refs-migrate.sh', + 't1500-rev-parse.sh', + 't1501-work-tree.sh', + 't1502-rev-parse-parseopt.sh', + 't1503-rev-parse-verify.sh', + 't1504-ceiling-dirs.sh', + 't1505-rev-parse-last.sh', + 't1506-rev-parse-diagnosis.sh', + 't1507-rev-parse-upstream.sh', + 't1508-at-combinations.sh', + 't1509-root-work-tree.sh', + 't1510-repo-setup.sh', + 't1511-rev-parse-caret.sh', + 't1512-rev-parse-disambiguation.sh', + 't1513-rev-parse-prefix.sh', + 't1514-rev-parse-push.sh', + 't1515-rev-parse-outside-repo.sh', + 't1517-outside-repo.sh', + 't1600-index.sh', + 't1601-index-bogus.sh', + 't1700-split-index.sh', + 't1701-racy-split-index.sh', + 't1800-hook.sh', + 't2000-conflict-when-checking-files-out.sh', + 't2002-checkout-cache-u.sh', + 't2003-checkout-cache-mkdir.sh', + 't2004-checkout-cache-temp.sh', + 't2005-checkout-index-symlinks.sh', + 't2006-checkout-index-basic.sh', + 't2007-checkout-symlink.sh', + 't2008-checkout-subdir.sh', + 't2009-checkout-statinfo.sh', + 't2010-checkout-ambiguous.sh', + 't2011-checkout-invalid-head.sh', + 't2012-checkout-last.sh', + 't2013-checkout-submodule.sh', + 't2014-checkout-switch.sh', + 't2015-checkout-unborn.sh', + 't2016-checkout-patch.sh', + 't2017-checkout-orphan.sh', + 't2018-checkout-branch.sh', + 't2019-checkout-ambiguous-ref.sh', + 't2020-checkout-detach.sh', + 't2021-checkout-overwrite.sh', + 't2022-checkout-paths.sh', + 't2023-checkout-m.sh', + 't2024-checkout-dwim.sh', + 't2025-checkout-no-overlay.sh', + 't2026-checkout-pathspec-file.sh', + 't2027-checkout-track.sh', + 't2030-unresolve-info.sh', + 't2050-git-dir-relative.sh', + 't2060-switch.sh', + 't2070-restore.sh', + 't2071-restore-patch.sh', + 't2072-restore-pathspec-file.sh', + 't2080-parallel-checkout-basics.sh', + 't2081-parallel-checkout-collisions.sh', + 't2082-parallel-checkout-attributes.sh', + 't2100-update-cache-badpath.sh', + 't2101-update-index-reupdate.sh', + 't2102-update-index-symlinks.sh', + 't2103-update-index-ignore-missing.sh', + 't2104-update-index-skip-worktree.sh', + 't2105-update-index-gitfile.sh', + 't2106-update-index-assume-unchanged.sh', + 't2107-update-index-basic.sh', + 't2108-update-index-refresh-racy.sh', + 't2200-add-update.sh', + 't2201-add-update-typechange.sh', + 't2202-add-addremove.sh', + 't2203-add-intent.sh', + 't2204-add-ignored.sh', + 't2205-add-worktree-config.sh', + 't2300-cd-to-toplevel.sh', + 't2400-worktree-add.sh', + 't2401-worktree-prune.sh', + 't2402-worktree-list.sh', + 't2403-worktree-move.sh', + 't2404-worktree-config.sh', + 't2405-worktree-submodule.sh', + 't2406-worktree-repair.sh', + 't2407-worktree-heads.sh', + 't2500-untracked-overwriting.sh', + 't2501-cwd-empty.sh', + 't3000-ls-files-others.sh', + 't3001-ls-files-others-exclude.sh', + 't3002-ls-files-dashpath.sh', + 't3003-ls-files-exclude.sh', + 't3004-ls-files-basic.sh', + 't3005-ls-files-relative.sh', + 't3006-ls-files-long.sh', + 't3007-ls-files-recurse-submodules.sh', + 't3008-ls-files-lazy-init-name-hash.sh', + 't3009-ls-files-others-nonsubmodule.sh', + 't3010-ls-files-killed-modified.sh', + 't3011-common-prefixes-and-directory-traversal.sh', + 't3012-ls-files-dedup.sh', + 't3013-ls-files-format.sh', + 't3020-ls-files-error-unmatch.sh', + 't3040-subprojects-basic.sh', + 't3050-subprojects-fetch.sh', + 't3060-ls-files-with-tree.sh', + 't3070-wildmatch.sh', + 't3100-ls-tree-restrict.sh', + 't3101-ls-tree-dirname.sh', + 't3102-ls-tree-wildcards.sh', + 't3103-ls-tree-misc.sh', + 't3104-ls-tree-format.sh', + 't3105-ls-tree-output.sh', + 't3200-branch.sh', + 't3201-branch-contains.sh', + 't3202-show-branch.sh', + 't3203-branch-output.sh', + 't3204-branch-name-interpretation.sh', + 't3205-branch-color.sh', + 't3206-range-diff.sh', + 't3207-branch-submodule.sh', + 't3211-peel-ref.sh', + 't3300-funny-names.sh', + 't3301-notes.sh', + 't3302-notes-index-expensive.sh', + 't3303-notes-subtrees.sh', + 't3304-notes-mixed.sh', + 't3305-notes-fanout.sh', + 't3306-notes-prune.sh', + 't3307-notes-man.sh', + 't3308-notes-merge.sh', + 't3309-notes-merge-auto-resolve.sh', + 't3310-notes-merge-manual-resolve.sh', + 't3311-notes-merge-fanout.sh', + 't3320-notes-merge-worktrees.sh', + 't3321-notes-stripspace.sh', + 't3400-rebase.sh', + 't3401-rebase-and-am-rename.sh', + 't3402-rebase-merge.sh', + 't3403-rebase-skip.sh', + 't3404-rebase-interactive.sh', + 't3405-rebase-malformed.sh', + 't3406-rebase-message.sh', + 't3407-rebase-abort.sh', + 't3408-rebase-multi-line.sh', + 't3409-rebase-environ.sh', + 't3412-rebase-root.sh', + 't3413-rebase-hook.sh', + 't3415-rebase-autosquash.sh', + 't3416-rebase-onto-threedots.sh', + 't3417-rebase-whitespace-fix.sh', + 't3418-rebase-continue.sh', + 't3419-rebase-patch-id.sh', + 't3420-rebase-autostash.sh', + 't3421-rebase-topology-linear.sh', + 't3422-rebase-incompatible-options.sh', + 't3423-rebase-reword.sh', + 't3424-rebase-empty.sh', + 't3425-rebase-topology-merges.sh', + 't3426-rebase-submodule.sh', + 't3427-rebase-subtree.sh', + 't3428-rebase-signoff.sh', + 't3429-rebase-edit-todo.sh', + 't3430-rebase-merges.sh', + 't3431-rebase-fork-point.sh', + 't3432-rebase-fast-forward.sh', + 't3433-rebase-across-mode-change.sh', + 't3434-rebase-i18n.sh', + 't3435-rebase-gpg-sign.sh', + 't3436-rebase-more-options.sh', + 't3437-rebase-fixup-options.sh', + 't3438-rebase-broken-files.sh', + 't3500-cherry.sh', + 't3501-revert-cherry-pick.sh', + 't3502-cherry-pick-merge.sh', + 't3503-cherry-pick-root.sh', + 't3504-cherry-pick-rerere.sh', + 't3505-cherry-pick-empty.sh', + 't3506-cherry-pick-ff.sh', + 't3507-cherry-pick-conflict.sh', + 't3508-cherry-pick-many-commits.sh', + 't3509-cherry-pick-merge-df.sh', + 't3510-cherry-pick-sequence.sh', + 't3511-cherry-pick-x.sh', + 't3512-cherry-pick-submodule.sh', + 't3513-revert-submodule.sh', + 't3514-cherry-pick-revert-gpg.sh', + 't3600-rm.sh', + 't3601-rm-pathspec-file.sh', + 't3602-rm-sparse-checkout.sh', + 't3650-replay-basics.sh', + 't3700-add.sh', + 't3701-add-interactive.sh', + 't3702-add-edit.sh', + 't3703-add-magic-pathspec.sh', + 't3704-add-pathspec-file.sh', + 't3705-add-sparse-checkout.sh', + 't3800-mktag.sh', + 't3900-i18n-commit.sh', + 't3901-i18n-patch.sh', + 't3902-quoted.sh', + 't3903-stash.sh', + 't3904-stash-patch.sh', + 't3905-stash-include-untracked.sh', + 't3906-stash-submodule.sh', + 't3907-stash-show-config.sh', + 't3908-stash-in-worktree.sh', + 't3909-stash-pathspec-file.sh', + 't3910-mac-os-precompose.sh', + 't3920-crlf-messages.sh', + 't4000-diff-format.sh', + 't4001-diff-rename.sh', + 't4002-diff-basic.sh', + 't4003-diff-rename-1.sh', + 't4004-diff-rename-symlink.sh', + 't4005-diff-rename-2.sh', + 't4006-diff-mode.sh', + 't4007-rename-3.sh', + 't4008-diff-break-rewrite.sh', + 't4009-diff-rename-4.sh', + 't4010-diff-pathspec.sh', + 't4011-diff-symlink.sh', + 't4012-diff-binary.sh', + 't4013-diff-various.sh', + 't4014-format-patch.sh', + 't4015-diff-whitespace.sh', + 't4016-diff-quote.sh', + 't4017-diff-retval.sh', + 't4018-diff-funcname.sh', + 't4019-diff-wserror.sh', + 't4020-diff-external.sh', + 't4021-format-patch-numbered.sh', + 't4022-diff-rewrite.sh', + 't4023-diff-rename-typechange.sh', + 't4024-diff-optimize-common.sh', + 't4025-hunk-header.sh', + 't4026-color.sh', + 't4027-diff-submodule.sh', + 't4028-format-patch-mime-headers.sh', + 't4029-diff-trailing-space.sh', + 't4030-diff-textconv.sh', + 't4031-diff-rewrite-binary.sh', + 't4032-diff-inter-hunk-context.sh', + 't4033-diff-patience.sh', + 't4034-diff-words.sh', + 't4035-diff-quiet.sh', + 't4036-format-patch-signer-mime.sh', + 't4037-diff-r-t-dirs.sh', + 't4038-diff-combined.sh', + 't4039-diff-assume-unchanged.sh', + 't4040-whitespace-status.sh', + 't4041-diff-submodule-option.sh', + 't4042-diff-textconv-caching.sh', + 't4043-diff-rename-binary.sh', + 't4044-diff-index-unique-abbrev.sh', + 't4045-diff-relative.sh', + 't4046-diff-unmerged.sh', + 't4047-diff-dirstat.sh', + 't4048-diff-combined-binary.sh', + 't4049-diff-stat-count.sh', + 't4050-diff-histogram.sh', + 't4051-diff-function-context.sh', + 't4052-stat-output.sh', + 't4053-diff-no-index.sh', + 't4054-diff-bogus-tree.sh', + 't4055-diff-context.sh', + 't4056-diff-order.sh', + 't4057-diff-combined-paths.sh', + 't4058-diff-duplicates.sh', + 't4059-diff-submodule-not-initialized.sh', + 't4060-diff-submodule-option-diff-format.sh', + 't4061-diff-indent.sh', + 't4062-diff-pickaxe.sh', + 't4063-diff-blobs.sh', + 't4064-diff-oidfind.sh', + 't4065-diff-anchored.sh', + 't4066-diff-emit-delay.sh', + 't4067-diff-partial-clone.sh', + 't4068-diff-symmetric-merge-base.sh', + 't4069-remerge-diff.sh', + 't4100-apply-stat.sh', + 't4101-apply-nonl.sh', + 't4102-apply-rename.sh', + 't4103-apply-binary.sh', + 't4104-apply-boundary.sh', + 't4105-apply-fuzz.sh', + 't4106-apply-stdin.sh', + 't4107-apply-ignore-whitespace.sh', + 't4108-apply-threeway.sh', + 't4109-apply-multifrag.sh', + 't4110-apply-scan.sh', + 't4111-apply-subdir.sh', + 't4112-apply-renames.sh', + 't4113-apply-ending.sh', + 't4114-apply-typechange.sh', + 't4115-apply-symlink.sh', + 't4116-apply-reverse.sh', + 't4117-apply-reject.sh', + 't4118-apply-empty-context.sh', + 't4119-apply-config.sh', + 't4120-apply-popt.sh', + 't4121-apply-diffs.sh', + 't4122-apply-symlink-inside.sh', + 't4123-apply-shrink.sh', + 't4124-apply-ws-rule.sh', + 't4125-apply-ws-fuzz.sh', + 't4126-apply-empty.sh', + 't4127-apply-same-fn.sh', + 't4128-apply-root.sh', + 't4129-apply-samemode.sh', + 't4130-apply-criss-cross-rename.sh', + 't4131-apply-fake-ancestor.sh', + 't4132-apply-removal.sh', + 't4133-apply-filenames.sh', + 't4134-apply-submodule.sh', + 't4135-apply-weird-filenames.sh', + 't4136-apply-check.sh', + 't4137-apply-submodule.sh', + 't4138-apply-ws-expansion.sh', + 't4139-apply-escape.sh', + 't4140-apply-ita.sh', + 't4141-apply-too-large.sh', + 't4150-am.sh', + 't4151-am-abort.sh', + 't4152-am-subjects.sh', + 't4153-am-resume-override-opts.sh', + 't4200-rerere.sh', + 't4201-shortlog.sh', + 't4202-log.sh', + 't4203-mailmap.sh', + 't4204-patch-id.sh', + 't4205-log-pretty-formats.sh', + 't4206-log-follow-harder-copies.sh', + 't4207-log-decoration-colors.sh', + 't4208-log-magic-pathspec.sh', + 't4209-log-pickaxe.sh', + 't4210-log-i18n.sh', + 't4211-line-log.sh', + 't4212-log-corrupt.sh', + 't4213-log-tabexpand.sh', + 't4214-log-graph-octopus.sh', + 't4215-log-skewed-merges.sh', + 't4216-log-bloom.sh', + 't4217-log-limit.sh', + 't4252-am-options.sh', + 't4253-am-keep-cr-dos.sh', + 't4254-am-corrupt.sh', + 't4255-am-submodule.sh', + 't4256-am-format-flowed.sh', + 't4257-am-interactive.sh', + 't4258-am-quoted-cr.sh', + 't4300-merge-tree.sh', + 't4301-merge-tree-write-tree.sh', + 't5000-tar-tree.sh', + 't5001-archive-attr.sh', + 't5002-archive-attr-pattern.sh', + 't5003-archive-zip.sh', + 't5004-archive-corner-cases.sh', + 't5100-mailinfo.sh', + 't5150-request-pull.sh', + 't5200-update-server-info.sh', + 't5300-pack-object.sh', + 't5301-sliding-window.sh', + 't5302-pack-index.sh', + 't5303-pack-corruption-resilience.sh', + 't5304-prune.sh', + 't5305-include-tag.sh', + 't5306-pack-nobase.sh', + 't5307-pack-missing-commit.sh', + 't5308-pack-detect-duplicates.sh', + 't5309-pack-delta-cycles.sh', + 't5310-pack-bitmaps.sh', + 't5311-pack-bitmaps-shallow.sh', + 't5312-prune-corruption.sh', + 't5313-pack-bounds-checks.sh', + 't5314-pack-cycle-detection.sh', + 't5315-pack-objects-compression.sh', + 't5316-pack-delta-depth.sh', + 't5317-pack-objects-filter-objects.sh', + 't5318-commit-graph.sh', + 't5319-multi-pack-index.sh', + 't5320-delta-islands.sh', + 't5321-pack-large-objects.sh', + 't5322-pack-objects-sparse.sh', + 't5323-pack-redundant.sh', + 't5324-split-commit-graph.sh', + 't5325-reverse-index.sh', + 't5326-multi-pack-bitmaps.sh', + 't5327-multi-pack-bitmaps-rev.sh', + 't5328-commit-graph-64bit-time.sh', + 't5329-pack-objects-cruft.sh', + 't5330-no-lazy-fetch-with-commit-graph.sh', + 't5331-pack-objects-stdin.sh', + 't5332-multi-pack-reuse.sh', + 't5333-pseudo-merge-bitmaps.sh', + 't5334-incremental-multi-pack-index.sh', + 't5351-unpack-large-objects.sh', + 't5400-send-pack.sh', + 't5401-update-hooks.sh', + 't5402-post-merge-hook.sh', + 't5403-post-checkout-hook.sh', + 't5404-tracking-branches.sh', + 't5405-send-pack-rewind.sh', + 't5406-remote-rejects.sh', + 't5407-post-rewrite-hook.sh', + 't5408-send-pack-stdin.sh', + 't5409-colorize-remote-messages.sh', + 't5410-receive-pack-alternates.sh', + 't5411-proc-receive-hook.sh', + 't5500-fetch-pack.sh', + 't5501-fetch-push-alternates.sh', + 't5502-quickfetch.sh', + 't5503-tagfollow.sh', + 't5504-fetch-receive-strict.sh', + 't5505-remote.sh', + 't5506-remote-groups.sh', + 't5507-remote-environment.sh', + 't5509-fetch-push-namespaces.sh', + 't5510-fetch.sh', + 't5511-refspec.sh', + 't5512-ls-remote.sh', + 't5513-fetch-track.sh', + 't5514-fetch-multiple.sh', + 't5515-fetch-merge-logic.sh', + 't5516-fetch-push.sh', + 't5517-push-mirror.sh', + 't5518-fetch-exit-status.sh', + 't5519-push-alternates.sh', + 't5520-pull.sh', + 't5521-pull-options.sh', + 't5522-pull-symlink.sh', + 't5523-push-upstream.sh', + 't5524-pull-msg.sh', + 't5525-fetch-tagopt.sh', + 't5526-fetch-submodules.sh', + 't5527-fetch-odd-refs.sh', + 't5528-push-default.sh', + 't5529-push-errors.sh', + 't5530-upload-pack-error.sh', + 't5531-deep-submodule-push.sh', + 't5532-fetch-proxy.sh', + 't5533-push-cas.sh', + 't5534-push-signed.sh', + 't5535-fetch-push-symref.sh', + 't5536-fetch-conflicts.sh', + 't5537-fetch-shallow.sh', + 't5538-push-shallow.sh', + 't5539-fetch-http-shallow.sh', + 't5540-http-push-webdav.sh', + 't5541-http-push-smart.sh', + 't5542-push-http-shallow.sh', + 't5543-atomic-push.sh', + 't5544-pack-objects-hook.sh', + 't5545-push-options.sh', + 't5546-receive-limits.sh', + 't5547-push-quarantine.sh', + 't5548-push-porcelain.sh', + 't5549-fetch-push-http.sh', + 't5550-http-fetch-dumb.sh', + 't5551-http-fetch-smart.sh', + 't5552-skipping-fetch-negotiator.sh', + 't5553-set-upstream.sh', + 't5554-noop-fetch-negotiator.sh', + 't5555-http-smart-common.sh', + 't5557-http-get.sh', + 't5558-clone-bundle-uri.sh', + 't5559-http-fetch-smart-http2.sh', + 't5560-http-backend-noserver.sh', + 't5561-http-backend.sh', + 't5562-http-backend-content-length.sh', + 't5563-simple-http-auth.sh', + 't5564-http-proxy.sh', + 't5570-git-daemon.sh', + 't5571-pre-push-hook.sh', + 't5572-pull-submodule.sh', + 't5573-pull-verify-signatures.sh', + 't5574-fetch-output.sh', + 't5580-unc-paths.sh', + 't5581-http-curl-verbose.sh', + 't5582-fetch-negative-refspec.sh', + 't5583-push-branches.sh', + 't5600-clone-fail-cleanup.sh', + 't5601-clone.sh', + 't5602-clone-remote-exec.sh', + 't5603-clone-dirname.sh', + 't5604-clone-reference.sh', + 't5605-clone-local.sh', + 't5606-clone-options.sh', + 't5607-clone-bundle.sh', + 't5608-clone-2gb.sh', + 't5609-clone-branch.sh', + 't5610-clone-detached.sh', + 't5611-clone-config.sh', + 't5612-clone-refspec.sh', + 't5613-info-alternate.sh', + 't5614-clone-submodules-shallow.sh', + 't5615-alternate-env.sh', + 't5616-partial-clone.sh', + 't5617-clone-submodules-remote.sh', + 't5618-alternate-refs.sh', + 't5619-clone-local-ambiguous-transport.sh', + 't5700-protocol-v1.sh', + 't5701-git-serve.sh', + 't5702-protocol-v2.sh', + 't5703-upload-pack-ref-in-want.sh', + 't5704-protocol-violations.sh', + 't5705-session-id-in-capabilities.sh', + 't5730-protocol-v2-bundle-uri-file.sh', + 't5731-protocol-v2-bundle-uri-git.sh', + 't5732-protocol-v2-bundle-uri-http.sh', + 't5750-bundle-uri-parse.sh', + 't5801-remote-helpers.sh', + 't5802-connect-helper.sh', + 't5810-proto-disable-local.sh', + 't5811-proto-disable-git.sh', + 't5812-proto-disable-http.sh', + 't5813-proto-disable-ssh.sh', + 't5814-proto-disable-ext.sh', + 't5815-submodule-protos.sh', + 't5900-repo-selection.sh', + 't6000-rev-list-misc.sh', + 't6001-rev-list-graft.sh', + 't6002-rev-list-bisect.sh', + 't6003-rev-list-topo-order.sh', + 't6004-rev-list-path-optim.sh', + 't6005-rev-list-count.sh', + 't6006-rev-list-format.sh', + 't6007-rev-list-cherry-pick-file.sh', + 't6008-rev-list-submodule.sh', + 't6009-rev-list-parent.sh', + 't6010-merge-base.sh', + 't6011-rev-list-with-bad-commit.sh', + 't6012-rev-list-simplify.sh', + 't6013-rev-list-reverse-parents.sh', + 't6014-rev-list-all.sh', + 't6016-rev-list-graph-simplify-history.sh', + 't6017-rev-list-stdin.sh', + 't6018-rev-list-glob.sh', + 't6019-rev-list-ancestry-path.sh', + 't6020-bundle-misc.sh', + 't6021-rev-list-exclude-hidden.sh', + 't6022-rev-list-missing.sh', + 't6030-bisect-porcelain.sh', + 't6040-tracking-info.sh', + 't6041-bisect-submodule.sh', + 't6050-replace.sh', + 't6060-merge-index.sh', + 't6100-rev-list-in-order.sh', + 't6101-rev-parse-parents.sh', + 't6102-rev-list-unexpected-objects.sh', + 't6110-rev-list-sparse.sh', + 't6111-rev-list-treesame.sh', + 't6112-rev-list-filters-objects.sh', + 't6113-rev-list-bitmap-filters.sh', + 't6114-keep-packs.sh', + 't6115-rev-list-du.sh', + 't6120-describe.sh', + 't6130-pathspec-noglob.sh', + 't6131-pathspec-icase.sh', + 't6132-pathspec-exclude.sh', + 't6133-pathspec-rev-dwim.sh', + 't6134-pathspec-in-submodule.sh', + 't6135-pathspec-with-attrs.sh', + 't6136-pathspec-in-bare.sh', + 't6200-fmt-merge-msg.sh', + 't6300-for-each-ref.sh', + 't6301-for-each-ref-errors.sh', + 't6302-for-each-ref-filter.sh', + 't6400-merge-df.sh', + 't6401-merge-criss-cross.sh', + 't6402-merge-rename.sh', + 't6403-merge-file.sh', + 't6404-recursive-merge.sh', + 't6405-merge-symlinks.sh', + 't6406-merge-attr.sh', + 't6407-merge-binary.sh', + 't6408-merge-up-to-date.sh', + 't6409-merge-subtree.sh', + 't6411-merge-filemode.sh', + 't6412-merge-large-rename.sh', + 't6413-merge-crlf.sh', + 't6414-merge-rename-nocruft.sh', + 't6415-merge-dir-to-symlink.sh', + 't6416-recursive-corner-cases.sh', + 't6417-merge-ours-theirs.sh', + 't6418-merge-text-auto.sh', + 't6419-merge-ignorecase.sh', + 't6421-merge-partial-clone.sh', + 't6422-merge-rename-corner-cases.sh', + 't6423-merge-rename-directories.sh', + 't6424-merge-unrelated-index-changes.sh', + 't6425-merge-rename-delete.sh', + 't6426-merge-skip-unneeded-updates.sh', + 't6427-diff3-conflict-markers.sh', + 't6428-merge-conflicts-sparse.sh', + 't6429-merge-sequence-rename-caching.sh', + 't6430-merge-recursive.sh', + 't6431-merge-criscross.sh', + 't6432-merge-recursive-space-options.sh', + 't6433-merge-toplevel.sh', + 't6434-merge-recursive-rename-options.sh', + 't6435-merge-sparse.sh', + 't6436-merge-overwrite.sh', + 't6437-submodule-merge.sh', + 't6438-submodule-directory-file-conflicts.sh', + 't6439-merge-co-error-msgs.sh', + 't6500-gc.sh', + 't6501-freshen-objects.sh', + 't6600-test-reach.sh', + 't6700-tree-depth.sh', + 't7001-mv.sh', + 't7002-mv-sparse-checkout.sh', + 't7003-filter-branch.sh', + 't7004-tag.sh', + 't7005-editor.sh', + 't7006-pager.sh', + 't7007-show.sh', + 't7008-filter-branch-null-sha1.sh', + 't7010-setup.sh', + 't7011-skip-worktree-reading.sh', + 't7012-skip-worktree-writing.sh', + 't7030-verify-tag.sh', + 't7031-verify-tag-signed-ssh.sh', + 't7060-wtstatus.sh', + 't7061-wtstatus-ignore.sh', + 't7062-wtstatus-ignorecase.sh', + 't7063-status-untracked-cache.sh', + 't7064-wtstatus-pv2.sh', + 't7101-reset-empty-subdirs.sh', + 't7102-reset.sh', + 't7103-reset-bare.sh', + 't7104-reset-hard.sh', + 't7105-reset-patch.sh', + 't7106-reset-unborn-branch.sh', + 't7107-reset-pathspec-file.sh', + 't7110-reset-merge.sh', + 't7111-reset-table.sh', + 't7112-reset-submodule.sh', + 't7113-post-index-change-hook.sh', + 't7201-co.sh', + 't7300-clean.sh', + 't7301-clean-interactive.sh', + 't7400-submodule-basic.sh', + 't7401-submodule-summary.sh', + 't7402-submodule-rebase.sh', + 't7403-submodule-sync.sh', + 't7406-submodule-update.sh', + 't7407-submodule-foreach.sh', + 't7408-submodule-reference.sh', + 't7409-submodule-detached-work-tree.sh', + 't7411-submodule-config.sh', + 't7412-submodule-absorbgitdirs.sh', + 't7413-submodule-is-active.sh', + 't7414-submodule-mistakes.sh', + 't7416-submodule-dash-url.sh', + 't7417-submodule-path-url.sh', + 't7418-submodule-sparse-gitmodules.sh', + 't7419-submodule-set-branch.sh', + 't7420-submodule-set-url.sh', + 't7421-submodule-summary-add.sh', + 't7422-submodule-output.sh', + 't7423-submodule-symlinks.sh', + 't7424-submodule-mixed-ref-formats.sh', + 't7450-bad-git-dotfiles.sh', + 't7500-commit-template-squash-signoff.sh', + 't7501-commit-basic-functionality.sh', + 't7502-commit-porcelain.sh', + 't7503-pre-commit-and-pre-merge-commit-hooks.sh', + 't7504-commit-msg-hook.sh', + 't7505-prepare-commit-msg-hook.sh', + 't7506-status-submodule.sh', + 't7507-commit-verbose.sh', + 't7508-status.sh', + 't7509-commit-authorship.sh', + 't7510-signed-commit.sh', + 't7511-status-index.sh', + 't7512-status-help.sh', + 't7513-interpret-trailers.sh', + 't7514-commit-patch.sh', + 't7515-status-symlinks.sh', + 't7516-commit-races.sh', + 't7517-per-repo-email.sh', + 't7518-ident-corner-cases.sh', + 't7519-status-fsmonitor.sh', + 't7520-ignored-hook-warning.sh', + 't7521-ignored-mode.sh', + 't7524-commit-summary.sh', + 't7525-status-rename.sh', + 't7526-commit-pathspec-file.sh', + 't7527-builtin-fsmonitor.sh', + 't7528-signed-commit-ssh.sh', + 't7600-merge.sh', + 't7601-merge-pull-config.sh', + 't7602-merge-octopus-many.sh', + 't7603-merge-reduce-heads.sh', + 't7604-merge-custom-message.sh', + 't7605-merge-resolve.sh', + 't7606-merge-custom.sh', + 't7607-merge-state.sh', + 't7608-merge-messages.sh', + 't7609-mergetool--lib.sh', + 't7610-mergetool.sh', + 't7611-merge-abort.sh', + 't7612-merge-verify-signatures.sh', + 't7614-merge-signoff.sh', + 't7615-diff-algo-with-mergy-operations.sh', + 't7700-repack.sh', + 't7701-repack-unpack-unreachable.sh', + 't7702-repack-cyclic-alternate.sh', + 't7703-repack-geometric.sh', + 't7704-repack-cruft.sh', + 't7800-difftool.sh', + 't7810-grep.sh', + 't7811-grep-open.sh', + 't7812-grep-icase-non-ascii.sh', + 't7813-grep-icase-iso.sh', + 't7814-grep-recurse-submodules.sh', + 't7815-grep-binary.sh', + 't7816-grep-binary-pattern.sh', + 't7817-grep-sparse-checkout.sh', + 't7900-maintenance.sh', + 't8001-annotate.sh', + 't8002-blame.sh', + 't8003-blame-corner-cases.sh', + 't8004-blame-with-conflicts.sh', + 't8005-blame-i18n.sh', + 't8006-blame-textconv.sh', + 't8007-cat-file-textconv.sh', + 't8008-blame-formats.sh', + 't8009-blame-vs-topicbranches.sh', + 't8010-cat-file-filters.sh', + 't8011-blame-split-file.sh', + 't8012-blame-colors.sh', + 't8013-blame-ignore-revs.sh', + 't8014-blame-ignore-fuzzy.sh', + 't9001-send-email.sh', + 't9002-column.sh', + 't9003-help-autocorrect.sh', + 't9100-git-svn-basic.sh', + 't9101-git-svn-props.sh', + 't9102-git-svn-deep-rmdir.sh', + 't9103-git-svn-tracked-directory-removed.sh', + 't9104-git-svn-follow-parent.sh', + 't9105-git-svn-commit-diff.sh', + 't9106-git-svn-commit-diff-clobber.sh', + 't9107-git-svn-migrate.sh', + 't9108-git-svn-glob.sh', + 't9109-git-svn-multi-glob.sh', + 't9110-git-svn-use-svm-props.sh', + 't9111-git-svn-use-svnsync-props.sh', + 't9112-git-svn-md5less-file.sh', + 't9113-git-svn-dcommit-new-file.sh', + 't9114-git-svn-dcommit-merge.sh', + 't9115-git-svn-dcommit-funky-renames.sh', + 't9116-git-svn-log.sh', + 't9117-git-svn-init-clone.sh', + 't9118-git-svn-funky-branch-names.sh', + 't9119-git-svn-info.sh', + 't9120-git-svn-clone-with-percent-escapes.sh', + 't9121-git-svn-fetch-renamed-dir.sh', + 't9122-git-svn-author.sh', + 't9123-git-svn-rebuild-with-rewriteroot.sh', + 't9124-git-svn-dcommit-auto-props.sh', + 't9125-git-svn-multi-glob-branch-names.sh', + 't9126-git-svn-follow-deleted-readded-directory.sh', + 't9127-git-svn-partial-rebuild.sh', + 't9128-git-svn-cmd-branch.sh', + 't9129-git-svn-i18n-commitencoding.sh', + 't9130-git-svn-authors-file.sh', + 't9131-git-svn-empty-symlink.sh', + 't9132-git-svn-broken-symlink.sh', + 't9133-git-svn-nested-git-repo.sh', + 't9134-git-svn-ignore-paths.sh', + 't9135-git-svn-moved-branch-empty-file.sh', + 't9136-git-svn-recreated-branch-empty-file.sh', + 't9137-git-svn-dcommit-clobber-series.sh', + 't9138-git-svn-authors-prog.sh', + 't9139-git-svn-non-utf8-commitencoding.sh', + 't9140-git-svn-reset.sh', + 't9141-git-svn-multiple-branches.sh', + 't9142-git-svn-shallow-clone.sh', + 't9143-git-svn-gc.sh', + 't9144-git-svn-old-rev_map.sh', + 't9145-git-svn-master-branch.sh', + 't9146-git-svn-empty-dirs.sh', + 't9147-git-svn-include-paths.sh', + 't9148-git-svn-propset.sh', + 't9150-svk-mergetickets.sh', + 't9151-svn-mergeinfo.sh', + 't9152-svn-empty-dirs-after-gc.sh', + 't9153-git-svn-rewrite-uuid.sh', + 't9154-git-svn-fancy-glob.sh', + 't9155-git-svn-fetch-deleted-tag.sh', + 't9156-git-svn-fetch-deleted-tag-2.sh', + 't9157-git-svn-fetch-merge.sh', + 't9158-git-svn-mergeinfo.sh', + 't9159-git-svn-no-parent-mergeinfo.sh', + 't9160-git-svn-preserve-empty-dirs.sh', + 't9161-git-svn-mergeinfo-push.sh', + 't9162-git-svn-dcommit-interactive.sh', + 't9163-git-svn-reset-clears-caches.sh', + 't9164-git-svn-dcommit-concurrent.sh', + 't9165-git-svn-fetch-merge-branch-of-branch.sh', + 't9166-git-svn-fetch-merge-branch-of-branch2.sh', + 't9167-git-svn-cmd-branch-subproject.sh', + 't9168-git-svn-partially-globbed-names.sh', + 't9169-git-svn-dcommit-crlf.sh', + 't9200-git-cvsexportcommit.sh', + 't9210-scalar.sh', + 't9211-scalar-clone.sh', + 't9300-fast-import.sh', + 't9301-fast-import-notes.sh', + 't9302-fast-import-unpack-limit.sh', + 't9303-fast-import-compression.sh', + 't9304-fast-import-marks.sh', + 't9350-fast-export.sh', + 't9351-fast-export-anonymize.sh', + 't9400-git-cvsserver-server.sh', + 't9401-git-cvsserver-crlf.sh', + 't9402-git-cvsserver-refs.sh', + 't9500-gitweb-standalone-no-errors.sh', + 't9501-gitweb-standalone-http-status.sh', + 't9502-gitweb-standalone-parse-output.sh', + 't9600-cvsimport.sh', + 't9601-cvsimport-vendor-branch.sh', + 't9602-cvsimport-branches-tags.sh', + 't9603-cvsimport-patchsets.sh', + 't9604-cvsimport-timestamps.sh', + 't9700-perl-git.sh', + 't9800-git-p4-basic.sh', + 't9801-git-p4-branch.sh', + 't9802-git-p4-filetype.sh', + 't9803-git-p4-shell-metachars.sh', + 't9804-git-p4-label.sh', + 't9805-git-p4-skip-submit-edit.sh', + 't9806-git-p4-options.sh', + 't9807-git-p4-submit.sh', + 't9808-git-p4-chdir.sh', + 't9809-git-p4-client-view.sh', + 't9810-git-p4-rcs.sh', + 't9811-git-p4-label-import.sh', + 't9812-git-p4-wildcards.sh', + 't9813-git-p4-preserve-users.sh', + 't9814-git-p4-rename.sh', + 't9815-git-p4-submit-fail.sh', + 't9816-git-p4-locked.sh', + 't9817-git-p4-exclude.sh', + 't9818-git-p4-block.sh', + 't9819-git-p4-case-folding.sh', + 't9820-git-p4-editor-handling.sh', + 't9821-git-p4-path-variations.sh', + 't9822-git-p4-path-encoding.sh', + 't9823-git-p4-mock-lfs.sh', + 't9824-git-p4-git-lfs.sh', + 't9825-git-p4-handle-utf16-without-bom.sh', + 't9826-git-p4-keep-empty-commits.sh', + 't9827-git-p4-change-filetype.sh', + 't9828-git-p4-map-user.sh', + 't9829-git-p4-jobs.sh', + 't9830-git-p4-symlink-dir.sh', + 't9831-git-p4-triggers.sh', + 't9832-unshelve.sh', + 't9833-errors.sh', + 't9834-git-p4-file-dir-bug.sh', + 't9835-git-p4-metadata-encoding-python2.sh', + 't9836-git-p4-metadata-encoding-python3.sh', + 't9850-shell.sh', + 't9901-git-web--browse.sh', + 't9902-completion.sh', + 't9903-bash-prompt.sh', +] + +# GIT_BUILD_DIR needs to be Unix-style without drive prefixes as it get added +# to the PATH variable. And given that drive prefixes contain a colon we'd +# otherwise end up with a broken PATH if we didn't convert it. +git_build_dir = meson.project_build_root() +if cygpath.found() + git_build_dir = run_command(cygpath, git_build_dir, check: true).stdout().strip() +endif + +test_environment = script_environment +test_environment.set('GIT_BUILD_DIR', git_build_dir) + +foreach integration_test : integration_tests + test(fs.stem(integration_test), shell, + args: [ integration_test ], + workdir: meson.current_source_dir(), + env: test_environment, + depends: test_dependencies + bin_wrappers, + timeout: 0, + ) +endforeach diff --git a/templates/hooks/meson.build b/templates/hooks/meson.build new file mode 100644 index 00000000000..9bef5d7cfad --- /dev/null +++ b/templates/hooks/meson.build @@ -0,0 +1,24 @@ +hooks = [ + 'applypatch-msg.sample', + 'commit-msg.sample', + 'fsmonitor-watchman.sample', + 'post-update.sample', + 'pre-applypatch.sample', + 'pre-commit.sample', + 'pre-merge-commit.sample', + 'prepare-commit-msg.sample', + 'pre-push.sample', + 'pre-rebase.sample', + 'pre-receive.sample', + 'push-to-checkout.sample', + 'sendemail-validate.sample', + 'update.sample', +] + +foreach hook : hooks + configure_file( + input: hook, + output: hook, + configuration: script_sh_config, + ) +endforeach diff --git a/templates/info/meson.build b/templates/info/meson.build new file mode 100644 index 00000000000..4ee1cfdf896 --- /dev/null +++ b/templates/info/meson.build @@ -0,0 +1,5 @@ +configure_file( + input: 'exclude', + output: 'exclude', + configuration: script_sh_config, +) diff --git a/templates/meson.build b/templates/meson.build new file mode 100644 index 00000000000..7428aaf1e6f --- /dev/null +++ b/templates/meson.build @@ -0,0 +1,8 @@ +configure_file( + input: 'description', + output: 'description', + configuration: script_sh_config, +) + +subdir('hooks') +subdir('info')