]> Kevux Git Server - rit/commit
contrib/credential: fix "netrc" tests with out-of-tree builds
authorPatrick Steinhardt <ps@pks.im>
Tue, 18 Feb 2025 07:45:50 +0000 (08:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 18 Feb 2025 19:40:03 +0000 (11:40 -0800)
commitfd21e6e447516421c5abdba21b483187a5637ba2
tree4f06c509b4a219c820d71a368826312992f2d06a
parentc5823641a6769a727d890a55160346d92808bc0c
contrib/credential: fix "netrc" tests with out-of-tree builds

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/credential/netrc/t-git-credential-netrc.sh
contrib/credential/netrc/test.pl