git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] meson: wire up bits and pieces from "contrib/"
@ 2025-02-18  7:45 Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 01/12] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
                   ` (13 more replies)
  0 siblings, 14 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Hi,

this patch series wires up a couple more bits and pieces, mostly from
"contrib/". Included are:

  - The "libsecret", "netrc", "osxkeychain" and "wincred" credential
    helpers.

  - The git-contact(1) script.

  - Coccinelle via a new "coccicheck" target that generates the semantic
    check.

  - The "gitk" graphical repository browser.

Not a lot of stuff is missing after this small patch series, as far as I
am aware. Omissions that I know of include "git-gui", "sparse" and perf
tests.

This patch series supersedes Mirth's patch series at [1]. I have picked
the compilation fix for MSVC from that series and retained authorship,
but with an amended commit message. I've also forged the SOB -- Mirth,
please let me know whether you're okay with this.

Thanks!

Patrick

[1]: <pull.1859.git.1739471859.gitgitgadget@gmail.com>

---
M Hickford (1):
      contrib/credential: fix compilation of wincred helper with MSVC

Patrick Steinhardt (11):
      GIT-BUILD-OPTIONS: propagate project's source directory
      contrib/credential: fix "netrc" tests with out-of-tree builds
      contrib/credential: fix compiling "libsecret" helper
      contrib/credential: fix compilation of "osxkeychain" helper
      meson: wire up credential helpers
      meson: wire up git-contacts(1)
      meson: wire up static analysis via Coccinelle
      gitk: extract script to build Gitk
      meson: wire up Gitk
      ci: fix propagating UTF-8 test locale in musl-based Meson job
      ci: exercise credential helpers

 .github/workflows/main.yml                         |  2 +-
 .gitlab-ci.yml                                     |  2 +-
 GIT-BUILD-OPTIONS.in                               |  3 +-
 Makefile                                           |  3 +-
 ci/install-dependencies.sh                         |  2 +-
 ci/lib.sh                                          | 10 ++-
 contrib/buildsystems/CMakeLists.txt                |  3 +-
 contrib/coccinelle/meson.build                     | 89 ++++++++++++++++++++++
 contrib/contacts/meson.build                       | 55 +++++++++++++
 .../libsecret/git-credential-libsecret.c           | 10 +--
 contrib/credential/libsecret/meson.build           |  9 +++
 contrib/credential/meson.build                     |  3 +
 contrib/credential/netrc/meson.build               | 20 +++++
 contrib/credential/netrc/t-git-credential-netrc.sh |  2 +-
 contrib/credential/netrc/test.pl                   |  7 +-
 .../osxkeychain/git-credential-osxkeychain.c       |  2 +-
 contrib/credential/osxkeychain/meson.build         |  9 +++
 .../credential/wincred/git-credential-wincred.c    |  2 +
 contrib/credential/wincred/meson.build             |  5 ++
 contrib/meson.build                                |  3 +
 gitk-git/Makefile                                  |  7 +-
 gitk-git/generate-tcl.sh                           | 11 +++
 gitk-git/meson.build                               | 28 +++++++
 gitk-git/po/meson.build                            | 19 +++++
 meson.build                                        |  7 +-
 meson_options.txt                                  |  8 +-
 t/lib-gettext.sh                                   |  2 +-
 t/t7609-mergetool--lib.sh                          |  2 +-
 28 files changed, 294 insertions(+), 31 deletions(-)


---
base-commit: 03944513488db4a81fdb4c21c3b515e4cb260b05
change-id: 20250206-b4-pks-meson-contrib-5d9b3a5d0830


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 01/12] GIT-BUILD-OPTIONS: propagate project's source directory
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 02/12] contrib/credential: fix "netrc" tests with out-of-tree builds Patrick Steinhardt
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

A couple of our tests require knowledge around where to find the
project's source directory in order to locate files required for the
test itself. Until now we have been wiring these up ad-hoc via new,
specialized variables catered to the specific usecase. This is quite
awkward though, as every test that potentially needs to locate paths
relative to the source directory needs to grow another variable.

Introduce a new "GIT_SOURCE_DIR" variable into GIT-BUILD-OPTIONS to stop
this proliferation. Remove existing variables that can be derived from
it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 GIT-BUILD-OPTIONS.in                | 3 +--
 Makefile                            | 3 +--
 contrib/buildsystems/CMakeLists.txt | 3 +--
 meson.build                         | 3 +--
 t/lib-gettext.sh                    | 2 +-
 t/t7609-mergetool--lib.sh           | 2 +-
 6 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index ada575fbcb7..0a9884e0ade 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -9,14 +9,13 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
 GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
 GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
 GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_SOURCE_DIR=@GIT_SOURCE_DIR@
 GIT_TEST_CMP=@GIT_TEST_CMP@
 GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
 GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
 GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
-GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
 GIT_TEST_OPTS=@GIT_TEST_OPTS@
 GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
-GIT_TEST_POPATH=@GIT_TEST_POPATH@
 GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
 GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
 GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
diff --git a/Makefile b/Makefile
index cd0806e1e69..a3483e15c4a 100644
--- a/Makefile
+++ b/Makefile
@@ -3192,14 +3192,13 @@ GIT-BUILD-OPTIONS: FORCE
 		-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
 		-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
 		-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+		-e "s|@GIT_SOURCE_DIR@|\'$(shell pwd)\'|" \
 		-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_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
 		-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-		-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
 		-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
 		-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-		-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
 		-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
 		-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
 		-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3179e7ff7a3..c6fbd57e158 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1169,14 +1169,13 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
 string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" 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_SOURCE_DIR@" "${CMAKE_SOURCE_DIR}" 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_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${CMAKE_BINARY_DIR}/mergetools'" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" 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_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
diff --git a/meson.build b/meson.build
index 0df3872c6ad..d77d7b6b603 100644
--- a/meson.build
+++ b/meson.build
@@ -1960,10 +1960,9 @@ subdir('contrib')
 
 foreach key, value : {
   'DIFF': diff.full_path(),
+  'GIT_SOURCE_DIR': meson.project_source_root(),
   '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'),
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index 7a734c6973e..b3dd68b0b95 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -7,7 +7,7 @@
 . ./test-lib.sh
 
 GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
-GIT_PO_PATH="$GIT_TEST_POPATH"
+GIT_PO_PATH="$GIT_SOURCE_DIR/po"
 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 e8e205707e4..af3ad284eed 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -7,7 +7,7 @@ Testing basic merge tools options'
 . ./test-lib.sh
 
 test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
-	. "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
+	. "$GIT_SOURCE_DIR"/mergetools/vimdiff &&
 	run_unit_tests
 '
 

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 02/12] contrib/credential: fix "netrc" tests with out-of-tree builds
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 01/12] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 03/12] contrib/credential: fix compilation of wincred helper with MSVC Patrick Steinhardt
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Tests of the "netrc" credential helper aren't prepared to handle
out-of-tree builds:

  - They expect the "test.pl" script to be located relative to the build
    directory, even though it is located in the source directory.

  - They expect the built "git-credential-netrc" helper to be located
    relative to the "test.pl" file, evne though it is loated in the
    build directory.

This works alright as long as source and build directories are the same,
but starts to break apart with Meson.

Fix these first issue by using the new "GIT_SOURCE_DIR" variable to
locate the test script itself. And fix the second issue by introducing a
new environment variable "CREDENTIAL_NETRC_PATH" that can be set for
out-of-tree builds to locate the built credential helper.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/netrc/t-git-credential-netrc.sh | 2 +-
 contrib/credential/netrc/test.pl                   | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/contrib/credential/netrc/t-git-credential-netrc.sh b/contrib/credential/netrc/t-git-credential-netrc.sh
index bf2777308a5..1b7b8b3a9aa 100755
--- a/contrib/credential/netrc/t-git-credential-netrc.sh
+++ b/contrib/credential/netrc/t-git-credential-netrc.sh
@@ -15,7 +15,7 @@
 
 	export PERL5LIB="$GITPERLLIB"
 	test_expect_success 'git-credential-netrc' '
-		perl "$GIT_BUILD_DIR"/contrib/credential/netrc/test.pl
+		perl "$GIT_SOURCE_DIR"/contrib/credential/netrc/test.pl
 	'
 
 	test_done
diff --git a/contrib/credential/netrc/test.pl b/contrib/credential/netrc/test.pl
index c0fb3718b28..67a0ede5644 100755
--- a/contrib/credential/netrc/test.pl
+++ b/contrib/credential/netrc/test.pl
@@ -15,10 +15,11 @@ BEGIN
 
 my @global_credential_args = @ARGV;
 my $scriptDir = dirname rel2abs $0;
-my ($netrc, $netrcGpg, $gcNetrc) = map { catfile $scriptDir, $_; }
+my ($netrc, $netrcGpg) = map { catfile $scriptDir, $_; }
                                        qw(test.netrc
-                                          test.netrc.gpg
-                                          git-credential-netrc);
+                                          test.netrc.gpg);
+my $gcNetrc = $ENV{CREDENTIAL_NETRC_PATH} || catfile $scriptDir, qw(git-credential-netrc);
+
 local $ENV{PATH} = join ':'
                       , $scriptDir
                       , $ENV{PATH}

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 03/12] contrib/credential: fix compilation of wincred helper with MSVC
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 01/12] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 02/12] contrib/credential: fix "netrc" tests with out-of-tree builds Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 04/12] contrib/credential: fix compiling "libsecret" helper Patrick Steinhardt
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

From: M Hickford <mirth.hickford@gmail.com>

The git-credential-wincred helper does not compile on Windows with
Microsoft Visual Studio because of our use of `__attribute__()`, which
its compiler doesn't support. While the rest of our codebase would know
to handle this because we redefine the macro in "compat/msvc.h", this
stub isn't available here because we don't include "git-compat-util.h"
in the first place.

Fix the issue by making the attribute depend on the `_MSC_VER`
preprocessor macro.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/wincred/git-credential-wincred.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index 4be0d58cd89..04145b51183 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -12,7 +12,9 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
+#ifndef _MSC_VER
 __attribute__((format (printf, 1, 2)))
+#endif
 static void die(const char *err, ...)
 {
 	char msg[4096];

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 04/12] contrib/credential: fix compiling "libsecret" helper
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (2 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 03/12] contrib/credential: fix compilation of wincred helper with MSVC Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 05/12] contrib/credential: fix compilation of "osxkeychain" helper Patrick Steinhardt
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

The "libsecret" credential helper does not compile when developer
warnings are enabled due to three warnings:

    - contrib/credential/libsecret/git-credential-libsecret.c:78:1:
      missing initializer for field ‘reserved’ of ‘SecretSchema’
      [-Werror=missing-field-initializers]. This issue is fixed by using
      designated initializers.

    - contrib/credential/libsecret/git-credential-libsecret.c:171:43:
      comparison of integer expressions of different signedness: ‘int’
      and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]. This
      issue is fixed by using an unsigned variable to iterate through
      the string vector.

    - contrib/credential/libsecret/git-credential-libsecret.c:420:14:
      unused parameter ‘argc’ [-Werror=unused-parameter]. This issue is
      fixed by checking the number of arguments, but in the least
      restrictive way possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/libsecret/git-credential-libsecret.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c
index 90034d0cf1e..941b2afd5ee 100644
--- a/contrib/credential/libsecret/git-credential-libsecret.c
+++ b/contrib/credential/libsecret/git-credential-libsecret.c
@@ -59,10 +59,10 @@ static void credential_clear(struct credential *c);
 /* ----------------- Secret Service functions ----------------- */
 
 static const SecretSchema schema = {
-	"org.git.Password",
+	.name = "org.git.Password",
 	/* Ignore schema name during search for backwards compatibility */
-	SECRET_SCHEMA_DONT_MATCH_NAME,
-	{
+	.flags = SECRET_SCHEMA_DONT_MATCH_NAME,
+	.attributes = {
 		/*
 		 * libsecret assumes attribute values are non-confidential and
 		 * unchanging, so we can't include oauth_refresh_token or
@@ -168,7 +168,7 @@ static int keyring_get(struct credential *c)
 				g_free(c->password);
 				c->password = g_strdup("");
 			}
-			for (int i = 1; i < g_strv_length(parts); i++) {
+			for (guint i = 1; i < g_strv_length(parts); i++) {
 				if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
 					g_free(c->password_expiry_utc);
 					c->password_expiry_utc = g_strdup(&parts[i][20]);
@@ -424,7 +424,7 @@ int main(int argc, char *argv[])
 	struct credential_operation const *try_op = credential_helper_ops;
 	struct credential cred = CREDENTIAL_INIT;
 
-	if (!argv[1]) {
+	if (argc < 2 || !*argv[1]) {
 		usage(argv[0]);
 		exit(EXIT_FAILURE);
 	}

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 05/12] contrib/credential: fix compilation of "osxkeychain" helper
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (3 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 04/12] contrib/credential: fix compiling "libsecret" helper Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 06/12] meson: wire up credential helpers Patrick Steinhardt
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

The "osxkeychain" helper does not compile due to a warning generated by
the unused `argc` parameter. Fix the warning by checking for the minimum
number of required arguments explicitly in the least restrictive way
possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/osxkeychain/git-credential-osxkeychain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 1c8310d7fef..611c9798b3a 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -422,7 +422,7 @@ int main(int argc, const char **argv)
 	const char *usage =
 		"usage: git credential-osxkeychain <get|store|erase>";
 
-	if (!argv[1])
+	if (argc < 2 || !*argv[1])
 		die("%s", usage);
 
 	if (open(argv[0], O_RDONLY | O_EXLOCK) == -1)

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 06/12] meson: wire up credential helpers
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (4 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 05/12] contrib/credential: fix compilation of "osxkeychain" helper Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18 10:11   ` M Hickford
  2025-02-18  7:45 ` [PATCH 07/12] meson: wire up git-contacts(1) Patrick Steinhardt
                   ` (7 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

We've got a couple of credential helpers in "contrib/credential", all
of which aren't yet wired up via Meson. Do so.

Note that ideally, we'd also wire up t0303 to be executed with each of
the credential helpers to verify their functionality. Unfortunately
though, none of them pass the test suite right now, so this is left for
a future change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/libsecret/meson.build   |  9 +++++++++
 contrib/credential/meson.build             |  3 +++
 contrib/credential/netrc/meson.build       | 20 ++++++++++++++++++++
 contrib/credential/osxkeychain/meson.build |  9 +++++++++
 contrib/credential/wincred/meson.build     |  5 +++++
 contrib/meson.build                        |  2 ++
 meson.build                                |  2 +-
 meson_options.txt                          |  2 ++
 8 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/contrib/credential/libsecret/meson.build b/contrib/credential/libsecret/meson.build
new file mode 100644
index 00000000000..0137660fe02
--- /dev/null
+++ b/contrib/credential/libsecret/meson.build
@@ -0,0 +1,9 @@
+executable('git-credential-libsecret',
+  sources: 'git-credential-libsecret.c',
+  dependencies: [
+    dependency('glib-2.0'),
+    dependency('libsecret-1'),
+  ],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
diff --git a/contrib/credential/meson.build b/contrib/credential/meson.build
new file mode 100644
index 00000000000..4216296ae05
--- /dev/null
+++ b/contrib/credential/meson.build
@@ -0,0 +1,3 @@
+foreach helper : get_option('credential_helpers')
+  subdir(helper)
+endforeach
diff --git a/contrib/credential/netrc/meson.build b/contrib/credential/netrc/meson.build
new file mode 100644
index 00000000000..a990dbb86da
--- /dev/null
+++ b/contrib/credential/netrc/meson.build
@@ -0,0 +1,20 @@
+credential_netrc = custom_target(
+  input: 'git-credential-netrc.perl',
+  output: 'git-credential-netrc',
+  command: generate_perl_command,
+  depends: [git_version_file],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
+
+credential_netrc_testenv = test_environment
+credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
+
+test('t-git-credential-netrc',
+  shell,
+  args: [ meson.current_source_dir() / 't-git-credential-netrc.sh' ],
+  workdir: meson.current_source_dir(),
+  env: credential_netrc_testenv,
+  depends: test_dependencies + bin_wrappers + [credential_netrc],
+  timeout: 0,
+)
diff --git a/contrib/credential/osxkeychain/meson.build b/contrib/credential/osxkeychain/meson.build
new file mode 100644
index 00000000000..3c7677f736c
--- /dev/null
+++ b/contrib/credential/osxkeychain/meson.build
@@ -0,0 +1,9 @@
+executable('git-credential-osxkeychain',
+  sources: 'git-credential-osxkeychain.c',
+  dependencies: [
+    dependency('CoreFoundation'),
+    dependency('Security'),
+  ],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
diff --git a/contrib/credential/wincred/meson.build b/contrib/credential/wincred/meson.build
new file mode 100644
index 00000000000..6de23ca17d4
--- /dev/null
+++ b/contrib/credential/wincred/meson.build
@@ -0,0 +1,5 @@
+executable('git-credential-wincred',
+  sources: 'git-credential-wincred.c',
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
diff --git a/contrib/meson.build b/contrib/meson.build
index d74b64a5181..569c23ee768 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -1,3 +1,5 @@
 foreach feature : get_option('contrib')
   subdir(feature)
 endforeach
+
+subdir('credential')
diff --git a/meson.build b/meson.build
index d77d7b6b603..20159cef83d 100644
--- a/meson.build
+++ b/meson.build
@@ -771,7 +771,7 @@ endif
 # 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') or get_option('gitweb').enabled()
+if get_option('tests') or get_option('gitweb').enabled() or 'netrc' in get_option('credential_helpers')
   perl_required = true
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 5c12e9055e6..0b0708dd0ed 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -29,6 +29,8 @@ option('version', type: 'string', value: '',
 # Features supported by Git.
 option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ],
   description: 'Contributed features to include.')
+option('credential_helpers', type: 'array', value: [ ], choices: [ 'libsecret', 'netrc', 'osxkeychain', 'wincred' ],
+  description: 'Contributed features to include.')
 option('curl', type: 'feature', value: 'enabled',
   description: 'Build helpers used to access remotes with the HTTP transport.')
 option('expat', type: 'feature', value: 'enabled',

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 07/12] meson: wire up git-contacts(1)
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (5 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 06/12] meson: wire up credential helpers Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 08/12] meson: wire up static analysis via Coccinelle Patrick Steinhardt
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Wire up the build for git-contacts(1) in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/contacts/meson.build | 55 ++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt            |  2 +-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/contrib/contacts/meson.build b/contrib/contacts/meson.build
new file mode 100644
index 00000000000..6ec92f47c43
--- /dev/null
+++ b/contrib/contacts/meson.build
@@ -0,0 +1,55 @@
+custom_target(
+  input: 'git-contacts',
+  output: 'git-contacts',
+  command: generate_perl_command,
+  depends: [git_version_file],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('docs').contains('man')
+  contacts_xml = custom_target(
+    command: asciidoc_common_options + [
+      '--backend=' + asciidoc_docbook,
+      '--doctype=manpage',
+      '--out-file=@OUTPUT@',
+      '@INPUT@',
+    ],
+    depends: documentation_deps,
+    input: 'git-contacts.txt',
+    output: 'git-contacts.xml',
+  )
+
+  custom_target(
+    command: [
+      xmlto,
+      '-m', '@INPUT@',
+      'man',
+      contacts_xml,
+      '-o',
+      meson.current_build_dir(),
+    ] + xmlto_extra,
+    input: [
+      '../../Documentation/manpage-normal.xsl',
+    ],
+    output: 'git-contacts.1',
+    install: true,
+    install_dir: get_option('mandir') / 'man1',
+  )
+endif
+
+if get_option('docs').contains('html')
+  custom_target(
+    command: asciidoc_common_options + [
+      '--backend=' + asciidoc_html,
+      '--doctype=manpage',
+      '--out-file=@OUTPUT@',
+      '@INPUT@',
+    ],
+    depends: documentation_deps,
+    input: 'git-contacts.txt',
+    output: 'git-contacts.html',
+    install: true,
+    install_dir: get_option('datadir') / 'doc/git-doc',
+  )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 0b0708dd0ed..c51ba88d853 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,7 +27,7 @@ option('version', type: 'string', value: '',
   description: 'Version string reported by git-version(1) and other tools.')
 
 # Features supported by Git.
-option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ],
+option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'contacts', 'subtree' ],
   description: 'Contributed features to include.')
 option('credential_helpers', type: 'array', value: [ ], choices: [ 'libsecret', 'netrc', 'osxkeychain', 'wincred' ],
   description: 'Contributed features to include.')

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 08/12] meson: wire up static analysis via Coccinelle
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (6 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 07/12] meson: wire up git-contacts(1) Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 09/12] gitk: extract script to build Gitk Patrick Steinhardt
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Wire up static analysis via Coccinelle via a new test target
"coccicheck". This target can be executed via `meson compile coccicheck`
and generates the semantic patch for us.

Note that we don't hardcode the list of source and header files that
shall be analyzed, and instead use git-ls-files(1) to find them for us.
This is because we also want to analyze files that may not get built on
the current platform, so finding all sources at configure time is easier
than introducing a new variable that tracks all sources, including those
which aren't being built.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/coccinelle/meson.build | 89 ++++++++++++++++++++++++++++++++++++++++++
 contrib/meson.build            |  1 +
 meson_options.txt              |  2 +
 3 files changed, 92 insertions(+)

diff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build
new file mode 100644
index 00000000000..5d76a7fee6f
--- /dev/null
+++ b/contrib/coccinelle/meson.build
@@ -0,0 +1,89 @@
+spatch = find_program('spatch', required: get_option('coccinelle'))
+if not spatch.found()
+  subdir_done()
+endif
+
+third_party_sources = [
+  ':!contrib',
+  ':!compat/inet_ntop.c',
+  ':!compat/inet_pton.c',
+  ':!compat/nedmalloc',
+  ':!compat/obstack.*',
+  ':!compat/poll',
+  ':!compat/regex',
+  ':!sha1collisiondetection',
+  ':!sha1dc',
+  ':!t/unit-tests/clar',
+  ':!t/unit-tests/clar',
+  ':!t/t[0-9][0-9][0-9][0-9]*',
+]
+
+rules = [
+  'array.cocci',
+  'commit.cocci',
+  'config_fn_ctx.pending.cocci',
+  'equals-null.cocci',
+  'flex_alloc.cocci',
+  'free.cocci',
+  'git_config_number.cocci',
+  'hashmap.cocci',
+  'index-compatibility.cocci',
+  'object_id.cocci',
+  'preincr.cocci',
+  'qsort.cocci',
+  'refs.cocci',
+  'strbuf.cocci',
+  'swap.cocci',
+  'the_repository.cocci',
+  'xcalloc.cocci',
+  'xopen.cocci',
+  'xstrdup_or_null.cocci',
+  'xstrncmpz.cocci',
+]
+
+concatenated_rules = custom_target(
+  command: [
+    'cat', '@INPUT@',
+  ],
+  input: rules,
+  output: 'rules.cocci',
+  capture: true,
+)
+
+sources = [ ]
+foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()
+  sources += source
+endforeach
+
+headers = [ ]
+foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
+  headers += meson.project_source_root() / header
+endforeach
+
+patches = [ ]
+foreach source : sources
+  patches += custom_target(
+    command: [
+      spatch,
+      '--all-includes',
+      '--sp-file', concatenated_rules,
+      '--patch', meson.project_source_root(),
+      '@INPUT@',
+    ],
+    input: meson.project_source_root() / source,
+    output: source.underscorify() + '.patch',
+    capture: true,
+    depend_files: headers,
+  )
+endforeach
+
+concatenated_patch = custom_target(
+  command: [
+    'cat', '@INPUT@',
+  ],
+  input: patches,
+  output: 'cocci.patch',
+  capture: true,
+)
+
+alias_target('coccicheck', concatenated_patch)
diff --git a/contrib/meson.build b/contrib/meson.build
index 569c23ee768..a88c5dfe09e 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -2,4 +2,5 @@ foreach feature : get_option('contrib')
   subdir(feature)
 endforeach
 
+subdir('coccinelle')
 subdir('credential')
diff --git a/meson_options.txt b/meson_options.txt
index c51ba88d853..afa908d6c53 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -101,6 +101,8 @@ option('docs_backend', type: 'combo', choices: ['asciidoc', 'asciidoctor', 'auto
   description: 'Which backend to use to generate documentation.')
 
 # Testing.
+option('coccinelle', type: 'feature', value: 'auto',
+  description: 'Provide a coccicheck target that generates a Coccinelle patch.')
 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',

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 09/12] gitk: extract script to build Gitk
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (7 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 08/12] meson: wire up static analysis via Coccinelle Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18 22:25   ` Junio C Hamano
  2025-02-18  7:45 ` [PATCH 10/12] meson: wire up Gitk Patrick Steinhardt
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Extract the script that "builds" Gitk from our Makefile so that we can
reuse it in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 gitk-git/Makefile        |  7 +++----
 gitk-git/generate-tcl.sh | 11 +++++++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/gitk-git/Makefile b/gitk-git/Makefile
index e1f0aff4a19..a396eef581e 100644
--- a/gitk-git/Makefile
+++ b/gitk-git/Makefile
@@ -8,6 +8,7 @@ gitk_libdir   ?= $(sharedir)/gitk/lib
 msgsdir    ?= $(gitk_libdir)/msgs
 msgsdir_SQ  = $(subst ','\'',$(msgsdir))
 
+SHELL_PATH ?= /bin/sh
 TCL_PATH ?= tclsh
 TCLTK_PATH ?= wish
 INSTALL ?= install
@@ -63,10 +64,8 @@ clean::
 	$(RM) gitk-wish po/*.msg GIT-TCLTK-VARS
 
 gitk-wish: gitk GIT-TCLTK-VARS
-	$(QUIET_GEN)$(RM) $@ $@+ && \
-	sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
-	chmod +x $@+ && \
-	mv -f $@+ $@
+	$(QUIET_GEN)$(RM) $@ $@+
+	$(QUIET_GEN)$(SHELL_PATH) ./generate-tcl.sh "$(TCLTK_PATH_SQ)" "$<" "$@"
 
 $(PO_TEMPLATE): gitk
 	$(XGETTEXT) -kmc -LTcl -o $@ gitk
diff --git a/gitk-git/generate-tcl.sh b/gitk-git/generate-tcl.sh
new file mode 100755
index 00000000000..46bba6d2464
--- /dev/null
+++ b/gitk-git/generate-tcl.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+WISH=$(echo "$1" | sed 's/|/\\|/g')
+INPUT="$2"
+OUTPUT="$3"
+
+sed -e "1,3s|^exec .* \"\$0\"|exec $WISH \"\$0\"|" "$INPUT" >"$OUTPUT"+
+chmod a+x "$OUTPUT"+
+mv "$OUTPUT"+ "$OUTPUT"

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 10/12] meson: wire up Gitk
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (8 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 09/12] gitk: extract script to build Gitk Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:45 ` [PATCH 11/12] ci: fix propagating UTF-8 test locale in musl-based Meson job Patrick Steinhardt
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Wire up the Gitk graphical repository browser in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 gitk-git/meson.build    | 28 ++++++++++++++++++++++++++++
 gitk-git/po/meson.build | 19 +++++++++++++++++++
 meson.build             |  2 ++
 meson_options.txt       |  2 ++
 4 files changed, 51 insertions(+)

diff --git a/gitk-git/meson.build b/gitk-git/meson.build
new file mode 100644
index 00000000000..7b16cd3c4d3
--- /dev/null
+++ b/gitk-git/meson.build
@@ -0,0 +1,28 @@
+wish = find_program('wish', required: get_option('gitk'))
+gitk_enabled = wish.found()
+
+if not gitk_enabled
+  subdir_done()
+endif
+
+custom_target(
+  command: [
+    shell,
+    meson.current_source_dir() / 'generate-tcl.sh',
+    wish.full_path(),
+    '@INPUT@',
+    '@OUTPUT@',
+  ],
+  input: 'gitk',
+  output: 'gitk',
+  depend_files: [
+    'generate-tcl.sh',
+  ],
+  env: script_environment,
+  install: true,
+  install_dir: get_option('bindir'),
+)
+
+if intl.found()
+  subdir('po')
+endif
diff --git a/gitk-git/po/meson.build b/gitk-git/po/meson.build
new file mode 100644
index 00000000000..b1ed0198285
--- /dev/null
+++ b/gitk-git/po/meson.build
@@ -0,0 +1,19 @@
+import('i18n').gettext('gitk',
+  languages: [
+    'bg',
+    'ca',
+    'de',
+    'es',
+    'fr',
+    'hu',
+    'it',
+    'ja',
+    'pt_br',
+    'pt_pt',
+    'ru',
+    'sv',
+    'vi',
+    'zh_cn',
+  ],
+  install: true,
+)
diff --git a/meson.build b/meson.build
index 20159cef83d..5f2db6b0419 100644
--- a/meson.build
+++ b/meson.build
@@ -1957,6 +1957,7 @@ if get_option('docs') != []
 endif
 
 subdir('contrib')
+subdir('gitk-git')
 
 foreach key, value : {
   'DIFF': diff.full_path(),
@@ -2010,6 +2011,7 @@ summary({
   'curl': curl.found(),
   'expat': expat.found(),
   'gettext': intl.found(),
+  'gitk': gitk_enabled,
   'gitweb': gitweb_option.allowed(),
   'https': https_backend,
   'iconv': iconv.found(),
diff --git a/meson_options.txt b/meson_options.txt
index afa908d6c53..4cce8a81154 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -41,6 +41,8 @@ option('gitweb', type: 'feature', value: 'auto',
   description: 'Build Git web interface. Requires Perl.')
 option('iconv', type: 'feature', value: 'auto',
   description: 'Support reencoding strings with different encodings.')
+option('gitk', type: 'feature', value: 'auto',
+  description: 'Build and install gitk(1), which requires Tcl.')
 option('pcre2', type: 'feature', value: 'enabled',
   description: 'Support Perl-compatible regular expressions in e.g. git-grep(1).')
 option('perl', type: 'feature', value: 'auto',

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 11/12] ci: fix propagating UTF-8 test locale in musl-based Meson job
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (9 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 10/12] meson: wire up Gitk Patrick Steinhardt
@ 2025-02-18  7:45 ` Patrick Steinhardt
  2025-02-18  7:46 ` [PATCH 12/12] ci: exercise credential helpers Patrick Steinhardt
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:45 UTC (permalink / raw)
  To: git; +Cc: M Hickford

The musl-based Meson job is supposed to explicitly specify the UTF-8
locale used for testing, which has been introduced with 84bb5eeace7 (ci:
switch linux-musl to use Meson, 2025-01-28). That commit had two issues
though:

  - We continue to refer to "linux-musl", even though the job has been
    renamed in the same commit to "linux-musl-meson".

  - We use the wrong option name to specify the locale. This was not
    noticed though due to the first issue.

Fix both of these issues by fixing both the job and option naems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 ci/lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ci/lib.sh b/ci/lib.sh
index 028fea0e7b5..84d11452650 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -348,8 +348,8 @@ case "$jobname" in
 linux32)
 	CC=gcc
 	;;
-linux-musl)
-	MESONFLAGS="$MESONFLAGS -DGIT_TEST_UTF8_LOCALE=C.UTF-8"
+linux-musl-meson)
+	MESONFLAGS="$MESONFLAGS -Dtest_utf8_locale=C.UTF-8"
 	;;
 linux-leaks|linux-reftable-leaks)
 	export SANITIZE=leak

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 12/12] ci: exercise credential helpers
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (10 preceding siblings ...)
  2025-02-18  7:45 ` [PATCH 11/12] ci: fix propagating UTF-8 test locale in musl-based Meson job Patrick Steinhardt
@ 2025-02-18  7:46 ` Patrick Steinhardt
  2025-02-18 10:10 ` [PATCH 00/12] meson: wire up bits and pieces from "contrib/" M Hickford
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
  13 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18  7:46 UTC (permalink / raw)
  To: git; +Cc: M Hickford

Wire up credential helpers in our CI runs so that we can rest assured
that they compile and (if tests are available) function correctly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 .github/workflows/main.yml | 2 +-
 .gitlab-ci.yml             | 2 +-
 ci/install-dependencies.sh | 2 +-
 ci/lib.sh                  | 6 ++++++
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5f756dfc2e2..9959b61ece2 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -265,7 +265,7 @@ jobs:
       run: pip install meson ninja
     - name: Setup
       shell: pwsh
-      run: meson setup build -Dperl=disabled
+      run: meson setup build -Dperl=disabled -Dcredential_helpers=wincred
     - name: Compile
       shell: pwsh
       run: meson compile -C build
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f29181708f..bb7d0c9ef1c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -164,7 +164,7 @@ build:msvc-meson:
   extends: .msvc-meson
   stage: build
   script:
-    - meson setup build -Dperl=disabled
+    - meson setup build -Dperl=disabled -Dcredential_helpers=wincred
     - meson compile -C build
   artifacts:
     paths:
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 332ba960039..0df74610d06 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -58,7 +58,7 @@ ubuntu-*|i386/ubuntu-*|debian-*)
 		make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
 		tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
 		libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
-		libpcre2-dev meson ninja-build pkg-config \
+		libsecret-1-dev libpcre2-dev meson ninja-build pkg-config \
 		${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
 
 	case "$distro" in
diff --git a/ci/lib.sh b/ci/lib.sh
index 84d11452650..f561884d401 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -348,6 +348,9 @@ case "$jobname" in
 linux32)
 	CC=gcc
 	;;
+linux-meson)
+	MESONFLAGS="$MESONFLAGS -Dcredential_helpers=libsecret,netrc"
+	;;
 linux-musl-meson)
 	MESONFLAGS="$MESONFLAGS -Dtest_utf8_locale=C.UTF-8"
 	;;
@@ -359,6 +362,9 @@ linux-asan-ubsan)
 	export NO_SVN_TESTS=LetsSaveSomeTime
 	MAKEFLAGS="$MAKEFLAGS NO_PYTHON=YepBecauseP4FlakesTooOften"
 	;;
+osx-meson)
+	MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
+	;;
 esac
 
 MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 00/12] meson: wire up bits and pieces from "contrib/"
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (11 preceding siblings ...)
  2025-02-18  7:46 ` [PATCH 12/12] ci: exercise credential helpers Patrick Steinhardt
@ 2025-02-18 10:10 ` M Hickford
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
  13 siblings, 0 replies; 37+ messages in thread
From: M Hickford @ 2025-02-18 10:10 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, M Hickford

> This patch series supersedes Mirth's patch series at [1]. I have picked
> the compilation fix for MSVC from that series and retained authorship,
> but with an amended commit message. I've also forged the SOB -- Mirth,
> please let me know whether you're okay with this.

Great work, thanks Patrick

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 06/12] meson: wire up credential helpers
  2025-02-18  7:45 ` [PATCH 06/12] meson: wire up credential helpers Patrick Steinhardt
@ 2025-02-18 10:11   ` M Hickford
  2025-02-18 11:13     ` Patrick Steinhardt
  0 siblings, 1 reply; 37+ messages in thread
From: M Hickford @ 2025-02-18 10:11 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, M Hickford

> Note that ideally, we'd also wire up t0303 to be executed with each of
> the credential helpers to verify their functionality. Unfortunately
> though, none of them pass the test suite right now, so this is left for
> a future change.

Out of curiosity, which tests failed?

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 06/12] meson: wire up credential helpers
  2025-02-18 10:11   ` M Hickford
@ 2025-02-18 11:13     ` Patrick Steinhardt
  2025-03-29  7:15       ` M Hickford
  0 siblings, 1 reply; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-18 11:13 UTC (permalink / raw)
  To: M Hickford; +Cc: git

On Tue, Feb 18, 2025 at 10:11:23AM +0000, M Hickford wrote:
> > Note that ideally, we'd also wire up t0303 to be executed with each of
> > the credential helpers to verify their functionality. Unfortunately
> > though, none of them pass the test suite right now, so this is left for
> > a future change.
> 
> Out of curiosity, which tests failed?

Basically all of them. I originally had the patch at the bottom of this
email. With that in place, we re-run t0303 for every configured
credential helper, where `GIT_TEST_CREDENTIAL_HELPER` is set to the
respective credential helper under test. We have to disable parallel
tests there because the test state directories would otherwise conflict
with one another.

Now you can for example:

    $ meson setup build -Dcredential_helpers=libsecret,netrc
    $ meson test -C build t0303-*

And that shows failures like:

    --- expect-stderr	2025-02-18 11:09:33.323668205 +0000
    +++ stderr	2025-02-18 11:09:33.347668278 +0000
    @@ -1,2 +1,4 @@
    +
    +** (process:75536): CRITICAL **: 11:09:33.339: lookup failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
     askpass: Username for 'https://example.com':
     askpass: Password for 'https://askpass-username@example.com':
    error: last command exited with $?=1
    not ok 1 - helper (/home/pks/Development/git/build/contrib/credential/libsecret/git-credential-libsecret) has no existing data

I might be missing how exactly to set all of this up so that things
actually work. Maybe I have to do something specific for each of the
helpers via `GIT_TEST_CREDENTIAL_HELPER_SETUP`. But t0303 isn't wired up
via our Makefiles for any of the helpers, as far as I can see, so I'm
unable to figure out what such a setup would look like.

Any hints would be welcome.

Patrick

--- >8 ---

diff --git a/contrib/credential/libsecret/meson.build b/contrib/credential/libsecret/meson.build
index 0137660fe02..cb5f7280823 100644
--- a/contrib/credential/libsecret/meson.build
+++ b/contrib/credential/libsecret/meson.build
@@ -1,4 +1,4 @@
-executable('git-credential-libsecret',
+credential_helpers += executable('git-credential-libsecret',
   sources: 'git-credential-libsecret.c',
   dependencies: [
     dependency('glib-2.0'),
diff --git a/contrib/credential/meson.build b/contrib/credential/meson.build
index 4216296ae05..f04525b728e 100644
--- a/contrib/credential/meson.build
+++ b/contrib/credential/meson.build
@@ -1,3 +1,20 @@
+credential_helpers = []
+
 foreach helper : get_option('credential_helpers')
   subdir(helper)
 endforeach
+
+foreach helper : credential_helpers
+  helper_test_environment = test_environment
+  helper_test_environment.set('GIT_TEST_CREDENTIAL_HELPER', helper.full_path())
+
+  test('t0303-credential-external-' + fs.stem(helper.full_path()),
+    shell,
+    args: [ meson.project_source_root() / 't/t0303-credential-external.sh' ],
+    workdir: meson.project_source_root() / 't',
+    env: helper_test_environment,
+    depends: test_dependencies + bin_wrappers + helper,
+    timeout: 0,
+    is_parallel: false,
+  )
+endforeach
diff --git a/contrib/credential/netrc/meson.build b/contrib/credential/netrc/meson.build
index a990dbb86da..110eac8f2f8 100644
--- a/contrib/credential/netrc/meson.build
+++ b/contrib/credential/netrc/meson.build
@@ -6,6 +6,7 @@ credential_netrc = custom_target(
   install: true,
   install_dir: get_option('libexecdir') / 'git-core',
 )
+credential_helpers += credential_netrc
 
 credential_netrc_testenv = test_environment
 credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
diff --git a/contrib/credential/osxkeychain/meson.build b/contrib/credential/osxkeychain/meson.build
index 3c7677f736c..545a8a25b4b 100644
--- a/contrib/credential/osxkeychain/meson.build
+++ b/contrib/credential/osxkeychain/meson.build
@@ -1,4 +1,4 @@
-executable('git-credential-osxkeychain',
+credential_helpers += executable('git-credential-osxkeychain',
   sources: 'git-credential-osxkeychain.c',
   dependencies: [
     dependency('CoreFoundation'),
diff --git a/contrib/credential/wincred/meson.build b/contrib/credential/wincred/meson.build
index 6de23ca17d4..fa669f038fe 100644
--- a/contrib/credential/wincred/meson.build
+++ b/contrib/credential/wincred/meson.build
@@ -1,4 +1,4 @@
-executable('git-credential-wincred',
+credential_helpers += executable('git-credential-wincred',
   sources: 'git-credential-wincred.c',
   install: true,
   install_dir: get_option('libexecdir') / 'git-core',

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 09/12] gitk: extract script to build Gitk
  2025-02-18  7:45 ` [PATCH 09/12] gitk: extract script to build Gitk Patrick Steinhardt
@ 2025-02-18 22:25   ` Junio C Hamano
  2025-02-19  5:53     ` Patrick Steinhardt
  0 siblings, 1 reply; 37+ messages in thread
From: Junio C Hamano @ 2025-02-18 22:25 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Johannes Sixt, git, M Hickford

Patrick Steinhardt <ps@pks.im> writes:

> Extract the script that "builds" Gitk from our Makefile so that we can
> reuse it in Meson.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  gitk-git/Makefile        |  7 +++----
>  gitk-git/generate-tcl.sh | 11 +++++++++++
>  2 files changed, 14 insertions(+), 4 deletions(-)

You would want to coordinate this with Johannes Sixt, who may still
want to maintain the subtree arrangement.

Thanks.


> diff --git a/gitk-git/Makefile b/gitk-git/Makefile
> index e1f0aff4a19..a396eef581e 100644
> --- a/gitk-git/Makefile
> +++ b/gitk-git/Makefile
> @@ -8,6 +8,7 @@ gitk_libdir   ?= $(sharedir)/gitk/lib
>  msgsdir    ?= $(gitk_libdir)/msgs
>  msgsdir_SQ  = $(subst ','\'',$(msgsdir))
>  
> +SHELL_PATH ?= /bin/sh
>  TCL_PATH ?= tclsh
>  TCLTK_PATH ?= wish
>  INSTALL ?= install
> @@ -63,10 +64,8 @@ clean::
>  	$(RM) gitk-wish po/*.msg GIT-TCLTK-VARS
>  
>  gitk-wish: gitk GIT-TCLTK-VARS
> -	$(QUIET_GEN)$(RM) $@ $@+ && \
> -	sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
> -	chmod +x $@+ && \
> -	mv -f $@+ $@
> +	$(QUIET_GEN)$(RM) $@ $@+
> +	$(QUIET_GEN)$(SHELL_PATH) ./generate-tcl.sh "$(TCLTK_PATH_SQ)" "$<" "$@"
>  
>  $(PO_TEMPLATE): gitk
>  	$(XGETTEXT) -kmc -LTcl -o $@ gitk
> diff --git a/gitk-git/generate-tcl.sh b/gitk-git/generate-tcl.sh
> new file mode 100755
> index 00000000000..46bba6d2464
> --- /dev/null
> +++ b/gitk-git/generate-tcl.sh
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +
> +set -e
> +
> +WISH=$(echo "$1" | sed 's/|/\\|/g')
> +INPUT="$2"
> +OUTPUT="$3"
> +
> +sed -e "1,3s|^exec .* \"\$0\"|exec $WISH \"\$0\"|" "$INPUT" >"$OUTPUT"+
> +chmod a+x "$OUTPUT"+
> +mv "$OUTPUT"+ "$OUTPUT"

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 09/12] gitk: extract script to build Gitk
  2025-02-18 22:25   ` Junio C Hamano
@ 2025-02-19  5:53     ` Patrick Steinhardt
  2025-02-19 11:42       ` Johannes Sixt
  0 siblings, 1 reply; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19  5:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Sixt, git, M Hickford

On Tue, Feb 18, 2025 at 02:25:43PM -0800, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Extract the script that "builds" Gitk from our Makefile so that we can
> > reuse it in Meson.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> >  gitk-git/Makefile        |  7 +++----
> >  gitk-git/generate-tcl.sh | 11 +++++++++++
> >  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> You would want to coordinate this with Johannes Sixt, who may still
> want to maintain the subtree arrangement.

Oh, I had him in mind when writing the patch series, but thought that he
only maintained git-gui, not gitk. Must have been misremembering.

Anyway, Johannes, I'm happy to evict these changes from this patch
series and create them as a pull request against your tree. We should
then also be including the project as a `subproject()` so that it can be
used standalone.

Patrick

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 09/12] gitk: extract script to build Gitk
  2025-02-19  5:53     ` Patrick Steinhardt
@ 2025-02-19 11:42       ` Johannes Sixt
  2025-02-19 11:51         ` Patrick Steinhardt
  0 siblings, 1 reply; 37+ messages in thread
From: Johannes Sixt @ 2025-02-19 11:42 UTC (permalink / raw)
  To: Patrick Steinhardt, Junio C Hamano; +Cc: git, M Hickford

Am 19.02.25 um 06:53 schrieb Patrick Steinhardt:
> On Tue, Feb 18, 2025 at 02:25:43PM -0800, Junio C Hamano wrote:
>> You would want to coordinate this with Johannes Sixt, who may still
>> want to maintain the subtree arrangement.
> 
> Anyway, Johannes, I'm happy to evict these changes from this patch
> series and create them as a pull request against your tree. We should
> then also be including the project as a `subproject()` so that it can be
> used standalone.

We can do that.

But there will be a time frame where the Git repository already knows
how to (and wants to) build Gitk as subproject, but the Gitk repository
has not been pulled, yet, and is missing the corresponding Meson
instructions. Will this work, or should we wait until Gitk's part has
been integrated in the Git repository?

-- Hannes


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 09/12] gitk: extract script to build Gitk
  2025-02-19 11:42       ` Johannes Sixt
@ 2025-02-19 11:51         ` Patrick Steinhardt
  2025-02-19 17:32           ` Johannes Sixt
  0 siblings, 1 reply; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 11:51 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Junio C Hamano, git, M Hickford

On Wed, Feb 19, 2025 at 12:42:44PM +0100, Johannes Sixt wrote:
> Am 19.02.25 um 06:53 schrieb Patrick Steinhardt:
> > On Tue, Feb 18, 2025 at 02:25:43PM -0800, Junio C Hamano wrote:
> >> You would want to coordinate this with Johannes Sixt, who may still
> >> want to maintain the subtree arrangement.
> > 
> > Anyway, Johannes, I'm happy to evict these changes from this patch
> > series and create them as a pull request against your tree. We should
> > then also be including the project as a `subproject()` so that it can be
> > used standalone.
> 
> We can do that.
> 
> But there will be a time frame where the Git repository already knows
> how to (and wants to) build Gitk as subproject, but the Gitk repository
> has not been pulled, yet, and is missing the corresponding Meson
> instructions. Will this work, or should we wait until Gitk's part has
> been integrated in the Git repository?

I guess the easiest way is to land the Meson support in gitk first,
pull those changes into Git and then I'll create a follow-up patch
where we start to use gitk as a subproject. Does that work for you?

Patrick

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/"
  2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
                   ` (12 preceding siblings ...)
  2025-02-18 10:10 ` [PATCH 00/12] meson: wire up bits and pieces from "contrib/" M Hickford
@ 2025-02-19 13:13 ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 01/10] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
                     ` (10 more replies)
  13 siblings, 11 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

Hi,

this patch series wires up a couple more bits and pieces, mostly from
"contrib/". Included are:

  - The "libsecret", "netrc", "osxkeychain" and "wincred" credential
    helpers.

  - The git-contact(1) script.

  - Coccinelle via a new "coccicheck" target that generates the semantic
    check.

Not a lot of stuff is missing after this small patch series, as far as I
am aware. Omissions that I know of include "git-gui", "sparse" and perf
tests.

This patch series supersedes Mirth's patch series at [1]. I have picked
the compilation fix for MSVC from that series and retained authorship,
but with an amended commit message. I've also forged the SOB -- Mirth,
please let me know whether you're okay with this.

Changes in v2:
  - Dropped the gitk-related parts. I have instead created a pull
    request for gitk at https://github.com/j6t/gitk/pull/8.
  - Link to v1: https://lore.kernel.org/r/20250218-b4-pks-meson-contrib-v1-0-c3edd292beb8@pks.im

Thanks!

Patrick

[1]: <pull.1859.git.1739471859.gitgitgadget@gmail.com>

---
M Hickford (1):
      contrib/credential: fix compilation of wincred helper with MSVC

Patrick Steinhardt (9):
      GIT-BUILD-OPTIONS: propagate project's source directory
      contrib/credential: fix "netrc" tests with out-of-tree builds
      contrib/credential: fix compiling "libsecret" helper
      contrib/credential: fix compilation of "osxkeychain" helper
      meson: wire up credential helpers
      meson: wire up git-contacts(1)
      meson: wire up static analysis via Coccinelle
      ci: fix propagating UTF-8 test locale in musl-based Meson job
      ci: exercise credential helpers

 .github/workflows/main.yml                         |  2 +-
 .gitlab-ci.yml                                     |  2 +-
 GIT-BUILD-OPTIONS.in                               |  3 +-
 Makefile                                           |  3 +-
 ci/install-dependencies.sh                         |  2 +-
 ci/lib.sh                                          | 10 ++-
 contrib/buildsystems/CMakeLists.txt                |  3 +-
 contrib/coccinelle/meson.build                     | 89 ++++++++++++++++++++++
 contrib/contacts/meson.build                       | 55 +++++++++++++
 .../libsecret/git-credential-libsecret.c           | 10 +--
 contrib/credential/libsecret/meson.build           |  9 +++
 contrib/credential/meson.build                     |  3 +
 contrib/credential/netrc/meson.build               | 20 +++++
 contrib/credential/netrc/t-git-credential-netrc.sh |  2 +-
 contrib/credential/netrc/test.pl                   |  7 +-
 .../osxkeychain/git-credential-osxkeychain.c       |  2 +-
 contrib/credential/osxkeychain/meson.build         |  9 +++
 .../credential/wincred/git-credential-wincred.c    |  2 +
 contrib/credential/wincred/meson.build             |  5 ++
 contrib/meson.build                                |  3 +
 meson.build                                        |  5 +-
 meson_options.txt                                  |  6 +-
 t/lib-gettext.sh                                   |  2 +-
 t/t7609-mergetool--lib.sh                          |  2 +-
 24 files changed, 229 insertions(+), 27 deletions(-)

Range-diff versus v1:

 1:  f038c1b6a45 =  1:  1cbc7a0a2e3 GIT-BUILD-OPTIONS: propagate project's source directory
 2:  493714b2599 =  2:  7b280db6c74 contrib/credential: fix "netrc" tests with out-of-tree builds
 3:  6ca34876222 =  3:  63932bfaca2 contrib/credential: fix compilation of wincred helper with MSVC
 4:  f8004e550e3 =  4:  6f8bdb62e00 contrib/credential: fix compiling "libsecret" helper
 5:  56eaee681fb =  5:  cd01c7cdb28 contrib/credential: fix compilation of "osxkeychain" helper
 6:  fb06e907359 =  6:  2827ed818cc meson: wire up credential helpers
 7:  1720a22498c =  7:  84d5d994674 meson: wire up git-contacts(1)
 8:  d35fe9c7f1f =  8:  9a1a44e9db8 meson: wire up static analysis via Coccinelle
 9:  f3756bea4d2 <  -:  ----------- gitk: extract script to build Gitk
10:  091def75331 <  -:  ----------- meson: wire up Gitk
11:  5a6adc0c756 =  9:  05b11300b60 ci: fix propagating UTF-8 test locale in musl-based Meson job
12:  fdf80deb16a = 10:  92fa0c76c2b ci: exercise credential helpers

---
base-commit: 03944513488db4a81fdb4c21c3b515e4cb260b05
change-id: 20250206-b4-pks-meson-contrib-5d9b3a5d0830


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH v2 01/10] GIT-BUILD-OPTIONS: propagate project's source directory
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 02/10] contrib/credential: fix "netrc" tests with out-of-tree builds Patrick Steinhardt
                     ` (9 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

A couple of our tests require knowledge around where to find the
project's source directory in order to locate files required for the
test itself. Until now we have been wiring these up ad-hoc via new,
specialized variables catered to the specific usecase. This is quite
awkward though, as every test that potentially needs to locate paths
relative to the source directory needs to grow another variable.

Introduce a new "GIT_SOURCE_DIR" variable into GIT-BUILD-OPTIONS to stop
this proliferation. Remove existing variables that can be derived from
it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 GIT-BUILD-OPTIONS.in                | 3 +--
 Makefile                            | 3 +--
 contrib/buildsystems/CMakeLists.txt | 3 +--
 meson.build                         | 3 +--
 t/lib-gettext.sh                    | 2 +-
 t/t7609-mergetool--lib.sh           | 2 +-
 6 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/GIT-BUILD-OPTIONS.in b/GIT-BUILD-OPTIONS.in
index ada575fbcb7..0a9884e0ade 100644
--- a/GIT-BUILD-OPTIONS.in
+++ b/GIT-BUILD-OPTIONS.in
@@ -9,14 +9,13 @@ GIT_PERF_MAKE_COMMAND=@GIT_PERF_MAKE_COMMAND@
 GIT_PERF_MAKE_OPTS=@GIT_PERF_MAKE_OPTS@
 GIT_PERF_REPEAT_COUNT=@GIT_PERF_REPEAT_COUNT@
 GIT_PERF_REPO=@GIT_PERF_REPO@
+GIT_SOURCE_DIR=@GIT_SOURCE_DIR@
 GIT_TEST_CMP=@GIT_TEST_CMP@
 GIT_TEST_CMP_USE_COPIED_CONTEXT=@GIT_TEST_CMP_USE_COPIED_CONTEXT@
 GIT_TEST_GITPERLLIB=@GIT_TEST_GITPERLLIB@
 GIT_TEST_INDEX_VERSION=@GIT_TEST_INDEX_VERSION@
-GIT_TEST_MERGE_TOOLS_DIR=@GIT_TEST_MERGE_TOOLS_DIR@
 GIT_TEST_OPTS=@GIT_TEST_OPTS@
 GIT_TEST_PERL_FATAL_WARNINGS=@GIT_TEST_PERL_FATAL_WARNINGS@
-GIT_TEST_POPATH=@GIT_TEST_POPATH@
 GIT_TEST_TEMPLATE_DIR=@GIT_TEST_TEMPLATE_DIR@
 GIT_TEST_TEXTDOMAINDIR=@GIT_TEST_TEXTDOMAINDIR@
 GIT_TEST_UTF8_LOCALE=@GIT_TEST_UTF8_LOCALE@
diff --git a/Makefile b/Makefile
index cd0806e1e69..a3483e15c4a 100644
--- a/Makefile
+++ b/Makefile
@@ -3192,14 +3192,13 @@ GIT-BUILD-OPTIONS: FORCE
 		-e "s|@GIT_PERF_MAKE_OPTS@|\'$(GIT_PERF_MAKE_OPTS)\'|" \
 		-e "s|@GIT_PERF_REPEAT_COUNT@|\'$(GIT_PERF_REPEAT_COUNT)\'|" \
 		-e "s|@GIT_PERF_REPO@|\'$(GIT_PERF_REPO)\'|" \
+		-e "s|@GIT_SOURCE_DIR@|\'$(shell pwd)\'|" \
 		-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_GITPERLLIB@|\'$(shell pwd)/perl/build/lib\'|" \
 		-e "s|@GIT_TEST_INDEX_VERSION@|\'$(GIT_TEST_INDEX_VERSION)\'|" \
-		-e "s|@GIT_TEST_MERGE_TOOLS_DIR@|\'$(shell pwd)/mergetools\'|" \
 		-e "s|@GIT_TEST_OPTS@|\'$(GIT_TEST_OPTS)\'|" \
 		-e "s|@GIT_TEST_PERL_FATAL_WARNINGS@|\'$(GIT_TEST_PERL_FATAL_WARNINGS)\'|" \
-		-e "s|@GIT_TEST_POPATH@|\'$(shell pwd)/po\'|" \
 		-e "s|@GIT_TEST_TEMPLATE_DIR@|\'$(shell pwd)/templates/blt\'|" \
 		-e "s|@GIT_TEST_TEXTDOMAINDIR@|\'$(shell pwd)/po/build/locale\'|" \
 		-e "s|@GIT_TEST_UTF8_LOCALE@|\'$(GIT_TEST_UTF8_LOCALE)\'|" \
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index 3179e7ff7a3..c6fbd57e158 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -1169,14 +1169,13 @@ string(REPLACE "@GIT_PERF_MAKE_COMMAND@" "" git_build_options "${git_build_optio
 string(REPLACE "@GIT_PERF_MAKE_OPTS@" "" 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_SOURCE_DIR@" "${CMAKE_SOURCE_DIR}" 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_GITPERLLIB@" "'${CMAKE_BINARY_DIR}/perl/build/lib'" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_INDEX_VERSION@" "" git_build_options "${git_build_options}")
-string(REPLACE "@GIT_TEST_MERGE_TOOLS_DIR@" "'${CMAKE_BINARY_DIR}/mergetools'" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_OPTS@" "" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_PERL_FATAL_WARNINGS@" "" 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_TEXTDOMAINDIR@" "'${CMAKE_BINARY_DIR}/po/build/locale'" git_build_options "${git_build_options}")
 string(REPLACE "@GIT_TEST_UTF8_LOCALE@" "" git_build_options "${git_build_options}")
diff --git a/meson.build b/meson.build
index 0df3872c6ad..d77d7b6b603 100644
--- a/meson.build
+++ b/meson.build
@@ -1960,10 +1960,9 @@ subdir('contrib')
 
 foreach key, value : {
   'DIFF': diff.full_path(),
+  'GIT_SOURCE_DIR': meson.project_source_root(),
   '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'),
diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index 7a734c6973e..b3dd68b0b95 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -7,7 +7,7 @@
 . ./test-lib.sh
 
 GIT_TEXTDOMAINDIR="$GIT_TEST_TEXTDOMAINDIR"
-GIT_PO_PATH="$GIT_TEST_POPATH"
+GIT_PO_PATH="$GIT_SOURCE_DIR/po"
 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 e8e205707e4..af3ad284eed 100755
--- a/t/t7609-mergetool--lib.sh
+++ b/t/t7609-mergetool--lib.sh
@@ -7,7 +7,7 @@ Testing basic merge tools options'
 . ./test-lib.sh
 
 test_expect_success 'mergetool --tool=vimdiff creates the expected layout' '
-	. "$GIT_TEST_MERGE_TOOLS_DIR"/vimdiff &&
+	. "$GIT_SOURCE_DIR"/mergetools/vimdiff &&
 	run_unit_tests
 '
 

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 02/10] contrib/credential: fix "netrc" tests with out-of-tree builds
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 01/10] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 03/10] contrib/credential: fix compilation of wincred helper with MSVC Patrick Steinhardt
                     ` (8 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

Tests of the "netrc" credential helper aren't prepared to handle
out-of-tree builds:

  - They expect the "test.pl" script to be located relative to the build
    directory, even though it is located in the source directory.

  - They expect the built "git-credential-netrc" helper to be located
    relative to the "test.pl" file, evne though it is loated in the
    build directory.

This works alright as long as source and build directories are the same,
but starts to break apart with Meson.

Fix these first issue by using the new "GIT_SOURCE_DIR" variable to
locate the test script itself. And fix the second issue by introducing a
new environment variable "CREDENTIAL_NETRC_PATH" that can be set for
out-of-tree builds to locate the built credential helper.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/netrc/t-git-credential-netrc.sh | 2 +-
 contrib/credential/netrc/test.pl                   | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/contrib/credential/netrc/t-git-credential-netrc.sh b/contrib/credential/netrc/t-git-credential-netrc.sh
index bf2777308a5..1b7b8b3a9aa 100755
--- a/contrib/credential/netrc/t-git-credential-netrc.sh
+++ b/contrib/credential/netrc/t-git-credential-netrc.sh
@@ -15,7 +15,7 @@
 
 	export PERL5LIB="$GITPERLLIB"
 	test_expect_success 'git-credential-netrc' '
-		perl "$GIT_BUILD_DIR"/contrib/credential/netrc/test.pl
+		perl "$GIT_SOURCE_DIR"/contrib/credential/netrc/test.pl
 	'
 
 	test_done
diff --git a/contrib/credential/netrc/test.pl b/contrib/credential/netrc/test.pl
index c0fb3718b28..67a0ede5644 100755
--- a/contrib/credential/netrc/test.pl
+++ b/contrib/credential/netrc/test.pl
@@ -15,10 +15,11 @@ BEGIN
 
 my @global_credential_args = @ARGV;
 my $scriptDir = dirname rel2abs $0;
-my ($netrc, $netrcGpg, $gcNetrc) = map { catfile $scriptDir, $_; }
+my ($netrc, $netrcGpg) = map { catfile $scriptDir, $_; }
                                        qw(test.netrc
-                                          test.netrc.gpg
-                                          git-credential-netrc);
+                                          test.netrc.gpg);
+my $gcNetrc = $ENV{CREDENTIAL_NETRC_PATH} || catfile $scriptDir, qw(git-credential-netrc);
+
 local $ENV{PATH} = join ':'
                       , $scriptDir
                       , $ENV{PATH}

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 03/10] contrib/credential: fix compilation of wincred helper with MSVC
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 01/10] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 02/10] contrib/credential: fix "netrc" tests with out-of-tree builds Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 04/10] contrib/credential: fix compiling "libsecret" helper Patrick Steinhardt
                     ` (7 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

From: M Hickford <mirth.hickford@gmail.com>

The git-credential-wincred helper does not compile on Windows with
Microsoft Visual Studio because of our use of `__attribute__()`, which
its compiler doesn't support. While the rest of our codebase would know
to handle this because we redefine the macro in "compat/msvc.h", this
stub isn't available here because we don't include "git-compat-util.h"
in the first place.

Fix the issue by making the attribute depend on the `_MSC_VER`
preprocessor macro.

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/wincred/git-credential-wincred.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c
index 4be0d58cd89..04145b51183 100644
--- a/contrib/credential/wincred/git-credential-wincred.c
+++ b/contrib/credential/wincred/git-credential-wincred.c
@@ -12,7 +12,9 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
+#ifndef _MSC_VER
 __attribute__((format (printf, 1, 2)))
+#endif
 static void die(const char *err, ...)
 {
 	char msg[4096];

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 04/10] contrib/credential: fix compiling "libsecret" helper
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (2 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 03/10] contrib/credential: fix compilation of wincred helper with MSVC Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 05/10] contrib/credential: fix compilation of "osxkeychain" helper Patrick Steinhardt
                     ` (6 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

The "libsecret" credential helper does not compile when developer
warnings are enabled due to three warnings:

    - contrib/credential/libsecret/git-credential-libsecret.c:78:1:
      missing initializer for field ‘reserved’ of ‘SecretSchema’
      [-Werror=missing-field-initializers]. This issue is fixed by using
      designated initializers.

    - contrib/credential/libsecret/git-credential-libsecret.c:171:43:
      comparison of integer expressions of different signedness: ‘int’
      and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]. This
      issue is fixed by using an unsigned variable to iterate through
      the string vector.

    - contrib/credential/libsecret/git-credential-libsecret.c:420:14:
      unused parameter ‘argc’ [-Werror=unused-parameter]. This issue is
      fixed by checking the number of arguments, but in the least
      restrictive way possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/libsecret/git-credential-libsecret.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c
index 90034d0cf1e..941b2afd5ee 100644
--- a/contrib/credential/libsecret/git-credential-libsecret.c
+++ b/contrib/credential/libsecret/git-credential-libsecret.c
@@ -59,10 +59,10 @@ static void credential_clear(struct credential *c);
 /* ----------------- Secret Service functions ----------------- */
 
 static const SecretSchema schema = {
-	"org.git.Password",
+	.name = "org.git.Password",
 	/* Ignore schema name during search for backwards compatibility */
-	SECRET_SCHEMA_DONT_MATCH_NAME,
-	{
+	.flags = SECRET_SCHEMA_DONT_MATCH_NAME,
+	.attributes = {
 		/*
 		 * libsecret assumes attribute values are non-confidential and
 		 * unchanging, so we can't include oauth_refresh_token or
@@ -168,7 +168,7 @@ static int keyring_get(struct credential *c)
 				g_free(c->password);
 				c->password = g_strdup("");
 			}
-			for (int i = 1; i < g_strv_length(parts); i++) {
+			for (guint i = 1; i < g_strv_length(parts); i++) {
 				if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
 					g_free(c->password_expiry_utc);
 					c->password_expiry_utc = g_strdup(&parts[i][20]);
@@ -424,7 +424,7 @@ int main(int argc, char *argv[])
 	struct credential_operation const *try_op = credential_helper_ops;
 	struct credential cred = CREDENTIAL_INIT;
 
-	if (!argv[1]) {
+	if (argc < 2 || !*argv[1]) {
 		usage(argv[0]);
 		exit(EXIT_FAILURE);
 	}

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 05/10] contrib/credential: fix compilation of "osxkeychain" helper
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (3 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 04/10] contrib/credential: fix compiling "libsecret" helper Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 06/10] meson: wire up credential helpers Patrick Steinhardt
                     ` (5 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

The "osxkeychain" helper does not compile due to a warning generated by
the unused `argc` parameter. Fix the warning by checking for the minimum
number of required arguments explicitly in the least restrictive way
possible.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/osxkeychain/git-credential-osxkeychain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/credential/osxkeychain/git-credential-osxkeychain.c b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
index 1c8310d7fef..611c9798b3a 100644
--- a/contrib/credential/osxkeychain/git-credential-osxkeychain.c
+++ b/contrib/credential/osxkeychain/git-credential-osxkeychain.c
@@ -422,7 +422,7 @@ int main(int argc, const char **argv)
 	const char *usage =
 		"usage: git credential-osxkeychain <get|store|erase>";
 
-	if (!argv[1])
+	if (argc < 2 || !*argv[1])
 		die("%s", usage);
 
 	if (open(argv[0], O_RDONLY | O_EXLOCK) == -1)

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 06/10] meson: wire up credential helpers
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (4 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 05/10] contrib/credential: fix compilation of "osxkeychain" helper Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 07/10] meson: wire up git-contacts(1) Patrick Steinhardt
                     ` (4 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

We've got a couple of credential helpers in "contrib/credential", all
of which aren't yet wired up via Meson. Do so.

Note that ideally, we'd also wire up t0303 to be executed with each of
the credential helpers to verify their functionality. Unfortunately
though, none of them pass the test suite right now, so this is left for
a future change.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/credential/libsecret/meson.build   |  9 +++++++++
 contrib/credential/meson.build             |  3 +++
 contrib/credential/netrc/meson.build       | 20 ++++++++++++++++++++
 contrib/credential/osxkeychain/meson.build |  9 +++++++++
 contrib/credential/wincred/meson.build     |  5 +++++
 contrib/meson.build                        |  2 ++
 meson.build                                |  2 +-
 meson_options.txt                          |  2 ++
 8 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/contrib/credential/libsecret/meson.build b/contrib/credential/libsecret/meson.build
new file mode 100644
index 00000000000..0137660fe02
--- /dev/null
+++ b/contrib/credential/libsecret/meson.build
@@ -0,0 +1,9 @@
+executable('git-credential-libsecret',
+  sources: 'git-credential-libsecret.c',
+  dependencies: [
+    dependency('glib-2.0'),
+    dependency('libsecret-1'),
+  ],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
diff --git a/contrib/credential/meson.build b/contrib/credential/meson.build
new file mode 100644
index 00000000000..4216296ae05
--- /dev/null
+++ b/contrib/credential/meson.build
@@ -0,0 +1,3 @@
+foreach helper : get_option('credential_helpers')
+  subdir(helper)
+endforeach
diff --git a/contrib/credential/netrc/meson.build b/contrib/credential/netrc/meson.build
new file mode 100644
index 00000000000..a990dbb86da
--- /dev/null
+++ b/contrib/credential/netrc/meson.build
@@ -0,0 +1,20 @@
+credential_netrc = custom_target(
+  input: 'git-credential-netrc.perl',
+  output: 'git-credential-netrc',
+  command: generate_perl_command,
+  depends: [git_version_file],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
+
+credential_netrc_testenv = test_environment
+credential_netrc_testenv.set('CREDENTIAL_NETRC_PATH', credential_netrc.full_path())
+
+test('t-git-credential-netrc',
+  shell,
+  args: [ meson.current_source_dir() / 't-git-credential-netrc.sh' ],
+  workdir: meson.current_source_dir(),
+  env: credential_netrc_testenv,
+  depends: test_dependencies + bin_wrappers + [credential_netrc],
+  timeout: 0,
+)
diff --git a/contrib/credential/osxkeychain/meson.build b/contrib/credential/osxkeychain/meson.build
new file mode 100644
index 00000000000..3c7677f736c
--- /dev/null
+++ b/contrib/credential/osxkeychain/meson.build
@@ -0,0 +1,9 @@
+executable('git-credential-osxkeychain',
+  sources: 'git-credential-osxkeychain.c',
+  dependencies: [
+    dependency('CoreFoundation'),
+    dependency('Security'),
+  ],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
diff --git a/contrib/credential/wincred/meson.build b/contrib/credential/wincred/meson.build
new file mode 100644
index 00000000000..6de23ca17d4
--- /dev/null
+++ b/contrib/credential/wincred/meson.build
@@ -0,0 +1,5 @@
+executable('git-credential-wincred',
+  sources: 'git-credential-wincred.c',
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
diff --git a/contrib/meson.build b/contrib/meson.build
index d74b64a5181..569c23ee768 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -1,3 +1,5 @@
 foreach feature : get_option('contrib')
   subdir(feature)
 endforeach
+
+subdir('credential')
diff --git a/meson.build b/meson.build
index d77d7b6b603..20159cef83d 100644
--- a/meson.build
+++ b/meson.build
@@ -771,7 +771,7 @@ endif
 # 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') or get_option('gitweb').enabled()
+if get_option('tests') or get_option('gitweb').enabled() or 'netrc' in get_option('credential_helpers')
   perl_required = true
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 5c12e9055e6..0b0708dd0ed 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -29,6 +29,8 @@ option('version', type: 'string', value: '',
 # Features supported by Git.
 option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ],
   description: 'Contributed features to include.')
+option('credential_helpers', type: 'array', value: [ ], choices: [ 'libsecret', 'netrc', 'osxkeychain', 'wincred' ],
+  description: 'Contributed features to include.')
 option('curl', type: 'feature', value: 'enabled',
   description: 'Build helpers used to access remotes with the HTTP transport.')
 option('expat', type: 'feature', value: 'enabled',

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 07/10] meson: wire up git-contacts(1)
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (5 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 06/10] meson: wire up credential helpers Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 08/10] meson: wire up static analysis via Coccinelle Patrick Steinhardt
                     ` (3 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

Wire up the build for git-contacts(1) in Meson.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/contacts/meson.build | 55 ++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt            |  2 +-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/contrib/contacts/meson.build b/contrib/contacts/meson.build
new file mode 100644
index 00000000000..6ec92f47c43
--- /dev/null
+++ b/contrib/contacts/meson.build
@@ -0,0 +1,55 @@
+custom_target(
+  input: 'git-contacts',
+  output: 'git-contacts',
+  command: generate_perl_command,
+  depends: [git_version_file],
+  install: true,
+  install_dir: get_option('libexecdir') / 'git-core',
+)
+
+if get_option('docs').contains('man')
+  contacts_xml = custom_target(
+    command: asciidoc_common_options + [
+      '--backend=' + asciidoc_docbook,
+      '--doctype=manpage',
+      '--out-file=@OUTPUT@',
+      '@INPUT@',
+    ],
+    depends: documentation_deps,
+    input: 'git-contacts.txt',
+    output: 'git-contacts.xml',
+  )
+
+  custom_target(
+    command: [
+      xmlto,
+      '-m', '@INPUT@',
+      'man',
+      contacts_xml,
+      '-o',
+      meson.current_build_dir(),
+    ] + xmlto_extra,
+    input: [
+      '../../Documentation/manpage-normal.xsl',
+    ],
+    output: 'git-contacts.1',
+    install: true,
+    install_dir: get_option('mandir') / 'man1',
+  )
+endif
+
+if get_option('docs').contains('html')
+  custom_target(
+    command: asciidoc_common_options + [
+      '--backend=' + asciidoc_html,
+      '--doctype=manpage',
+      '--out-file=@OUTPUT@',
+      '@INPUT@',
+    ],
+    depends: documentation_deps,
+    input: 'git-contacts.txt',
+    output: 'git-contacts.html',
+    install: true,
+    install_dir: get_option('datadir') / 'doc/git-doc',
+  )
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 0b0708dd0ed..c51ba88d853 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,7 +27,7 @@ option('version', type: 'string', value: '',
   description: 'Version string reported by git-version(1) and other tools.')
 
 # Features supported by Git.
-option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'subtree' ],
+option('contrib', type: 'array', value: [ 'completion' ], choices: [ 'completion', 'contacts', 'subtree' ],
   description: 'Contributed features to include.')
 option('credential_helpers', type: 'array', value: [ ], choices: [ 'libsecret', 'netrc', 'osxkeychain', 'wincred' ],
   description: 'Contributed features to include.')

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 08/10] meson: wire up static analysis via Coccinelle
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (6 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 07/10] meson: wire up git-contacts(1) Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 09/10] ci: fix propagating UTF-8 test locale in musl-based Meson job Patrick Steinhardt
                     ` (2 subsequent siblings)
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

Wire up static analysis via Coccinelle via a new test target
"coccicheck". This target can be executed via `meson compile coccicheck`
and generates the semantic patch for us.

Note that we don't hardcode the list of source and header files that
shall be analyzed, and instead use git-ls-files(1) to find them for us.
This is because we also want to analyze files that may not get built on
the current platform, so finding all sources at configure time is easier
than introducing a new variable that tracks all sources, including those
which aren't being built.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 contrib/coccinelle/meson.build | 89 ++++++++++++++++++++++++++++++++++++++++++
 contrib/meson.build            |  1 +
 meson_options.txt              |  2 +
 3 files changed, 92 insertions(+)

diff --git a/contrib/coccinelle/meson.build b/contrib/coccinelle/meson.build
new file mode 100644
index 00000000000..5d76a7fee6f
--- /dev/null
+++ b/contrib/coccinelle/meson.build
@@ -0,0 +1,89 @@
+spatch = find_program('spatch', required: get_option('coccinelle'))
+if not spatch.found()
+  subdir_done()
+endif
+
+third_party_sources = [
+  ':!contrib',
+  ':!compat/inet_ntop.c',
+  ':!compat/inet_pton.c',
+  ':!compat/nedmalloc',
+  ':!compat/obstack.*',
+  ':!compat/poll',
+  ':!compat/regex',
+  ':!sha1collisiondetection',
+  ':!sha1dc',
+  ':!t/unit-tests/clar',
+  ':!t/unit-tests/clar',
+  ':!t/t[0-9][0-9][0-9][0-9]*',
+]
+
+rules = [
+  'array.cocci',
+  'commit.cocci',
+  'config_fn_ctx.pending.cocci',
+  'equals-null.cocci',
+  'flex_alloc.cocci',
+  'free.cocci',
+  'git_config_number.cocci',
+  'hashmap.cocci',
+  'index-compatibility.cocci',
+  'object_id.cocci',
+  'preincr.cocci',
+  'qsort.cocci',
+  'refs.cocci',
+  'strbuf.cocci',
+  'swap.cocci',
+  'the_repository.cocci',
+  'xcalloc.cocci',
+  'xopen.cocci',
+  'xstrdup_or_null.cocci',
+  'xstrncmpz.cocci',
+]
+
+concatenated_rules = custom_target(
+  command: [
+    'cat', '@INPUT@',
+  ],
+  input: rules,
+  output: 'rules.cocci',
+  capture: true,
+)
+
+sources = [ ]
+foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()
+  sources += source
+endforeach
+
+headers = [ ]
+foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
+  headers += meson.project_source_root() / header
+endforeach
+
+patches = [ ]
+foreach source : sources
+  patches += custom_target(
+    command: [
+      spatch,
+      '--all-includes',
+      '--sp-file', concatenated_rules,
+      '--patch', meson.project_source_root(),
+      '@INPUT@',
+    ],
+    input: meson.project_source_root() / source,
+    output: source.underscorify() + '.patch',
+    capture: true,
+    depend_files: headers,
+  )
+endforeach
+
+concatenated_patch = custom_target(
+  command: [
+    'cat', '@INPUT@',
+  ],
+  input: patches,
+  output: 'cocci.patch',
+  capture: true,
+)
+
+alias_target('coccicheck', concatenated_patch)
diff --git a/contrib/meson.build b/contrib/meson.build
index 569c23ee768..a88c5dfe09e 100644
--- a/contrib/meson.build
+++ b/contrib/meson.build
@@ -2,4 +2,5 @@ foreach feature : get_option('contrib')
   subdir(feature)
 endforeach
 
+subdir('coccinelle')
 subdir('credential')
diff --git a/meson_options.txt b/meson_options.txt
index c51ba88d853..afa908d6c53 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -101,6 +101,8 @@ option('docs_backend', type: 'combo', choices: ['asciidoc', 'asciidoctor', 'auto
   description: 'Which backend to use to generate documentation.')
 
 # Testing.
+option('coccinelle', type: 'feature', value: 'auto',
+  description: 'Provide a coccicheck target that generates a Coccinelle patch.')
 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',

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 09/10] ci: fix propagating UTF-8 test locale in musl-based Meson job
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (7 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 08/10] meson: wire up static analysis via Coccinelle Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-19 13:13   ` [PATCH v2 10/10] ci: exercise credential helpers Patrick Steinhardt
  2025-02-20  1:25   ` [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/" Ramsay Jones
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

The musl-based Meson job is supposed to explicitly specify the UTF-8
locale used for testing, which has been introduced with 84bb5eeace7 (ci:
switch linux-musl to use Meson, 2025-01-28). That commit had two issues
though:

  - We continue to refer to "linux-musl", even though the job has been
    renamed in the same commit to "linux-musl-meson".

  - We use the wrong option name to specify the locale. This was not
    noticed though due to the first issue.

Fix both of these issues by fixing both the job and option naems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 ci/lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ci/lib.sh b/ci/lib.sh
index 028fea0e7b5..84d11452650 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -348,8 +348,8 @@ case "$jobname" in
 linux32)
 	CC=gcc
 	;;
-linux-musl)
-	MESONFLAGS="$MESONFLAGS -DGIT_TEST_UTF8_LOCALE=C.UTF-8"
+linux-musl-meson)
+	MESONFLAGS="$MESONFLAGS -Dtest_utf8_locale=C.UTF-8"
 	;;
 linux-leaks|linux-reftable-leaks)
 	export SANITIZE=leak

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 10/10] ci: exercise credential helpers
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (8 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 09/10] ci: fix propagating UTF-8 test locale in musl-based Meson job Patrick Steinhardt
@ 2025-02-19 13:13   ` Patrick Steinhardt
  2025-02-20  1:25   ` [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/" Ramsay Jones
  10 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-19 13:13 UTC (permalink / raw)
  To: git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt

Wire up credential helpers in our CI runs so that we can rest assured
that they compile and (if tests are available) function correctly.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 .github/workflows/main.yml | 2 +-
 .gitlab-ci.yml             | 2 +-
 ci/install-dependencies.sh | 2 +-
 ci/lib.sh                  | 6 ++++++
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 5f756dfc2e2..9959b61ece2 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -265,7 +265,7 @@ jobs:
       run: pip install meson ninja
     - name: Setup
       shell: pwsh
-      run: meson setup build -Dperl=disabled
+      run: meson setup build -Dperl=disabled -Dcredential_helpers=wincred
     - name: Compile
       shell: pwsh
       run: meson compile -C build
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f29181708f..bb7d0c9ef1c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -164,7 +164,7 @@ build:msvc-meson:
   extends: .msvc-meson
   stage: build
   script:
-    - meson setup build -Dperl=disabled
+    - meson setup build -Dperl=disabled -Dcredential_helpers=wincred
     - meson compile -C build
   artifacts:
     paths:
diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
index 332ba960039..0df74610d06 100755
--- a/ci/install-dependencies.sh
+++ b/ci/install-dependencies.sh
@@ -58,7 +58,7 @@ ubuntu-*|i386/ubuntu-*|debian-*)
 		make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
 		tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
 		libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
-		libpcre2-dev meson ninja-build pkg-config \
+		libsecret-1-dev libpcre2-dev meson ninja-build pkg-config \
 		${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
 
 	case "$distro" in
diff --git a/ci/lib.sh b/ci/lib.sh
index 84d11452650..f561884d401 100755
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -348,6 +348,9 @@ case "$jobname" in
 linux32)
 	CC=gcc
 	;;
+linux-meson)
+	MESONFLAGS="$MESONFLAGS -Dcredential_helpers=libsecret,netrc"
+	;;
 linux-musl-meson)
 	MESONFLAGS="$MESONFLAGS -Dtest_utf8_locale=C.UTF-8"
 	;;
@@ -359,6 +362,9 @@ linux-asan-ubsan)
 	export NO_SVN_TESTS=LetsSaveSomeTime
 	MAKEFLAGS="$MAKEFLAGS NO_PYTHON=YepBecauseP4FlakesTooOften"
 	;;
+osx-meson)
+	MESONFLAGS="$MESONFLAGS -Dcredential_helpers=osxkeychain"
+	;;
 esac
 
 MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"

-- 
2.48.1.666.gff9fcf71b7.dirty


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 09/12] gitk: extract script to build Gitk
  2025-02-19 11:51         ` Patrick Steinhardt
@ 2025-02-19 17:32           ` Johannes Sixt
  0 siblings, 0 replies; 37+ messages in thread
From: Johannes Sixt @ 2025-02-19 17:32 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Junio C Hamano, git, M Hickford

Am 19.02.25 um 12:51 schrieb Patrick Steinhardt:
> I guess the easiest way is to land the Meson support in gitk first,
> pull those changes into Git and then I'll create a follow-up patch
> where we start to use gitk as a subproject. Does that work for you?

Sure, let's do that.

-- Hannes


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/"
  2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
                     ` (9 preceding siblings ...)
  2025-02-19 13:13   ` [PATCH v2 10/10] ci: exercise credential helpers Patrick Steinhardt
@ 2025-02-20  1:25   ` Ramsay Jones
  2025-02-20  6:25     ` Patrick Steinhardt
  10 siblings, 1 reply; 37+ messages in thread
From: Ramsay Jones @ 2025-02-20  1:25 UTC (permalink / raw)
  To: Patrick Steinhardt, git; +Cc: M Hickford, Junio C Hamano, Johannes Sixt



On 19/02/2025 13:13, Patrick Steinhardt wrote:
> Hi,
> 
> this patch series wires up a couple more bits and pieces, mostly from
> "contrib/". Included are:
> 
>   - The "libsecret", "netrc", "osxkeychain" and "wincred" credential
>     helpers.
> 
>   - The git-contact(1) script.
> 
>   - Coccinelle via a new "coccicheck" target that generates the semantic
>     check.
> 
> Not a lot of stuff is missing after this small patch series, as far as I
> am aware. Omissions that I know of include "git-gui", "sparse" and perf
> tests.

I regularly do 'make sparse' and 'make hdr-check' as part of my routine.

Note that ci/run-static-analysis.sh uses several targets:

  ci/run-static-analysis.sh:8:make coccicheck
  ci/run-static-analysis.sh:29:make hdr-check ||
  ci/run-static-analysis.sh:32:make check-pot

  ... and ci/test-documentation.sh some more:

  ci/test-documentation.sh:18:make check-builtins
  ci/test-documentation.sh:19:make check-docs

  ... and then there are some coverage targets like 'coverage-test' and
'coverage-report' (I haven't actually used them in decades ... ;) ).

ATB,
Ramsay Jones




^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/"
  2025-02-20  1:25   ` [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/" Ramsay Jones
@ 2025-02-20  6:25     ` Patrick Steinhardt
  2025-02-21 19:50       ` Ramsay Jones
  0 siblings, 1 reply; 37+ messages in thread
From: Patrick Steinhardt @ 2025-02-20  6:25 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: git, M Hickford, Junio C Hamano, Johannes Sixt

On Thu, Feb 20, 2025 at 01:25:59AM +0000, Ramsay Jones wrote:
> 
> 
> On 19/02/2025 13:13, Patrick Steinhardt wrote:
> > Hi,
> > 
> > this patch series wires up a couple more bits and pieces, mostly from
> > "contrib/". Included are:
> > 
> >   - The "libsecret", "netrc", "osxkeychain" and "wincred" credential
> >     helpers.
> > 
> >   - The git-contact(1) script.
> > 
> >   - Coccinelle via a new "coccicheck" target that generates the semantic
> >     check.
> > 
> > Not a lot of stuff is missing after this small patch series, as far as I
> > am aware. Omissions that I know of include "git-gui", "sparse" and perf
> > tests.
> 
> I regularly do 'make sparse' and 'make hdr-check' as part of my routine.
> 
> Note that ci/run-static-analysis.sh uses several targets:
> 
>   ci/run-static-analysis.sh:8:make coccicheck
>   ci/run-static-analysis.sh:29:make hdr-check ||
>   ci/run-static-analysis.sh:32:make check-pot
> 
>   ... and ci/test-documentation.sh some more:
> 
>   ci/test-documentation.sh:18:make check-builtins
>   ci/test-documentation.sh:19:make check-docs
> 
>   ... and then there are some coverage targets like 'coverage-test' and
> 'coverage-report' (I haven't actually used them in decades ... ;) ).

Ah, `make hdr-check` is something I forgot about indeed, yes. I guess
introducing those two targets will be one of the next patch series then
once the current patch series both land.

Coverage reports are something that Meson already does natively:

    meson setup build -Db_coverage=true
    meson compile -C build
    meson test -C build
    ninja -C build coverage-html

Patrick

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/"
  2025-02-20  6:25     ` Patrick Steinhardt
@ 2025-02-21 19:50       ` Ramsay Jones
  0 siblings, 0 replies; 37+ messages in thread
From: Ramsay Jones @ 2025-02-21 19:50 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, M Hickford, Junio C Hamano, Johannes Sixt



On 20/02/2025 06:25, Patrick Steinhardt wrote:
[snip]
> Coverage reports are something that Meson already does natively:
> 
>     meson setup build -Db_coverage=true
>     meson compile -C build
>     meson test -C build
>     ninja -C build coverage-html

I just tried this (I had to install 'gcovr' first) and the results
look pretty good:

  ...

  $ ninja -C build coverage-html
  ninja: Entering directory `build'
  [1/1] Generates HTML coverage report
  Ubuntu LLVM version 18.1.3
    Optimized build.
  (INFO) Reading coverage data...
  (INFO) Writing coverage report...
  lines: 85.2% (144103 out of 169233)
  functions: 93.3% (10404 out of 11151)
  branches: 76.0% (78627 out of 103419)

  Html coverage report can be found at file:///home/ramsay/git/build/meson-logs/coveragereport/index.html
  $ 

:)

[Although I have worked on projects where some of those numbers would have
been considered too low! :( ]


ATB,
Ramsay Jones



^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 06/12] meson: wire up credential helpers
  2025-02-18 11:13     ` Patrick Steinhardt
@ 2025-03-29  7:15       ` M Hickford
  2025-03-31  6:55         ` Patrick Steinhardt
  0 siblings, 1 reply; 37+ messages in thread
From: M Hickford @ 2025-03-29  7:15 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: M Hickford, git

On Tue, 18 Feb 2025 at 11:14, Patrick Steinhardt <ps@pks.im> wrote:
>
> On Tue, Feb 18, 2025 at 10:11:23AM +0000, M Hickford wrote:
> > > Note that ideally, we'd also wire up t0303 to be executed with each of
> > > the credential helpers to verify their functionality. Unfortunately
> > > though, none of them pass the test suite right now, so this is left for
> > > a future change.
> >
> > Out of curiosity, which tests failed?
>
> Basically all of them. I originally had the patch at the bottom of this
> email. With that in place, we re-run t0303 for every configured
> credential helper, where `GIT_TEST_CREDENTIAL_HELPER` is set to the
> respective credential helper under test. We have to disable parallel
> tests there because the test state directories would otherwise conflict
> with one another.
>
> Now you can for example:
>
>     $ meson setup build -Dcredential_helpers=libsecret,netrc
>     $ meson test -C build t0303-*
>
> And that shows failures like:
>
>     --- expect-stderr   2025-02-18 11:09:33.323668205 +0000
>     +++ stderr  2025-02-18 11:09:33.347668278 +0000
>     @@ -1,2 +1,4 @@
>     +
>     +** (process:75536): CRITICAL **: 11:09:33.339: lookup failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
>      askpass: Username for 'https://example.com':
>      askpass: Password for 'https://askpass-username@example.com':
>     error: last command exited with $?=1
>     not ok 1 - helper (/home/pks/Development/git/build/contrib/credential/libsecret/git-credential-libsecret) has no existing data
>
> I might be missing how exactly to set all of this up so that things
> actually work. Maybe I have to do something specific for each of the
> helpers via `GIT_TEST_CREDENTIAL_HELPER_SETUP`. But t0303 isn't wired up
> via our Makefiles for any of the helpers, as far as I can see, so I'm
> unable to figure out what such a setup would look like.
>
> Any hints would be welcome.

Before you can use git-credential-libsecret, you'd need to install
gnome-keyring, run gnome-keyring-daemon, and create a keyring
(choosing a password, can be empty).
https://unix.stackexchange.com/a/548005/7732

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 06/12] meson: wire up credential helpers
  2025-03-29  7:15       ` M Hickford
@ 2025-03-31  6:55         ` Patrick Steinhardt
  0 siblings, 0 replies; 37+ messages in thread
From: Patrick Steinhardt @ 2025-03-31  6:55 UTC (permalink / raw)
  To: M Hickford; +Cc: git

On Sat, Mar 29, 2025 at 07:15:00AM +0000, M Hickford wrote:
> On Tue, 18 Feb 2025 at 11:14, Patrick Steinhardt <ps@pks.im> wrote:
> >
> > On Tue, Feb 18, 2025 at 10:11:23AM +0000, M Hickford wrote:
> > > > Note that ideally, we'd also wire up t0303 to be executed with each of
> > > > the credential helpers to verify their functionality. Unfortunately
> > > > though, none of them pass the test suite right now, so this is left for
> > > > a future change.
> > >
> > > Out of curiosity, which tests failed?
> >
> > Basically all of them. I originally had the patch at the bottom of this
> > email. With that in place, we re-run t0303 for every configured
> > credential helper, where `GIT_TEST_CREDENTIAL_HELPER` is set to the
> > respective credential helper under test. We have to disable parallel
> > tests there because the test state directories would otherwise conflict
> > with one another.
> >
> > Now you can for example:
> >
> >     $ meson setup build -Dcredential_helpers=libsecret,netrc
> >     $ meson test -C build t0303-*
> >
> > And that shows failures like:
> >
> >     --- expect-stderr   2025-02-18 11:09:33.323668205 +0000
> >     +++ stderr  2025-02-18 11:09:33.347668278 +0000
> >     @@ -1,2 +1,4 @@
> >     +
> >     +** (process:75536): CRITICAL **: 11:09:33.339: lookup failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files
> >      askpass: Username for 'https://example.com':
> >      askpass: Password for 'https://askpass-username@example.com':
> >     error: last command exited with $?=1
> >     not ok 1 - helper (/home/pks/Development/git/build/contrib/credential/libsecret/git-credential-libsecret) has no existing data
> >
> > I might be missing how exactly to set all of this up so that things
> > actually work. Maybe I have to do something specific for each of the
> > helpers via `GIT_TEST_CREDENTIAL_HELPER_SETUP`. But t0303 isn't wired up
> > via our Makefiles for any of the helpers, as far as I can see, so I'm
> > unable to figure out what such a setup would look like.
> >
> > Any hints would be welcome.
> 
> Before you can use git-credential-libsecret, you'd need to install
> gnome-keyring, run gnome-keyring-daemon, and create a keyring
> (choosing a password, can be empty).
> https://unix.stackexchange.com/a/548005/7732

Hm, okay. Ideally, the test setup should take care of all of this and
also depend on gnome-keyring being available in the first place. Anyway,
this seems like a preexisitng issue that would also be the case with our
Makefile. As such it's not specific to the setup via Meson and I'm going
to leave it at that. #leftoverbits

Thanks for the hint!

Patrick

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2025-03-31  6:55 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-18  7:45 [PATCH 00/12] meson: wire up bits and pieces from "contrib/" Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 01/12] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 02/12] contrib/credential: fix "netrc" tests with out-of-tree builds Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 03/12] contrib/credential: fix compilation of wincred helper with MSVC Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 04/12] contrib/credential: fix compiling "libsecret" helper Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 05/12] contrib/credential: fix compilation of "osxkeychain" helper Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 06/12] meson: wire up credential helpers Patrick Steinhardt
2025-02-18 10:11   ` M Hickford
2025-02-18 11:13     ` Patrick Steinhardt
2025-03-29  7:15       ` M Hickford
2025-03-31  6:55         ` Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 07/12] meson: wire up git-contacts(1) Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 08/12] meson: wire up static analysis via Coccinelle Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 09/12] gitk: extract script to build Gitk Patrick Steinhardt
2025-02-18 22:25   ` Junio C Hamano
2025-02-19  5:53     ` Patrick Steinhardt
2025-02-19 11:42       ` Johannes Sixt
2025-02-19 11:51         ` Patrick Steinhardt
2025-02-19 17:32           ` Johannes Sixt
2025-02-18  7:45 ` [PATCH 10/12] meson: wire up Gitk Patrick Steinhardt
2025-02-18  7:45 ` [PATCH 11/12] ci: fix propagating UTF-8 test locale in musl-based Meson job Patrick Steinhardt
2025-02-18  7:46 ` [PATCH 12/12] ci: exercise credential helpers Patrick Steinhardt
2025-02-18 10:10 ` [PATCH 00/12] meson: wire up bits and pieces from "contrib/" M Hickford
2025-02-19 13:13 ` [PATCH v2 00/10] " Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 01/10] GIT-BUILD-OPTIONS: propagate project's source directory Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 02/10] contrib/credential: fix "netrc" tests with out-of-tree builds Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 03/10] contrib/credential: fix compilation of wincred helper with MSVC Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 04/10] contrib/credential: fix compiling "libsecret" helper Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 05/10] contrib/credential: fix compilation of "osxkeychain" helper Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 06/10] meson: wire up credential helpers Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 07/10] meson: wire up git-contacts(1) Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 08/10] meson: wire up static analysis via Coccinelle Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 09/10] ci: fix propagating UTF-8 test locale in musl-based Meson job Patrick Steinhardt
2025-02-19 13:13   ` [PATCH v2 10/10] ci: exercise credential helpers Patrick Steinhardt
2025-02-20  1:25   ` [-SPAM-] [PATCH v2 00/10] meson: wire up bits and pieces from "contrib/" Ramsay Jones
2025-02-20  6:25     ` Patrick Steinhardt
2025-02-21 19:50       ` Ramsay Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).