LinuxCommandLibrary

git-remote-testgit

Test Git remote helper implementations

SYNOPSIS

git-remote-testgit [-v] [-h] [-i] [--advertise-refs]

PARAMETERS

-v
    Increment verbosity (repeat for more detail)

-h
    Print usage and exit

-i
    Exit immediately after capabilities

--advertise-refs
    Print capabilities and refs immediately, then exit

DESCRIPTION

The git-remote-testgit command is a specialized utility within Git's test suite. It emulates a remote Git server to facilitate testing of Git's remote operations, such as fetch, push, ref advertisement, and protocol negotiations, without needing an external server.

This helper fully implements the Git remote helper protocol defined in git-remote-helpers(7). It handles commands like capabilities, list for refs, option settings (e.g., verbosity), and connect for bidirectional smart HTTP/Git protocol simulation.

Primarily invoked in Git test scripts (e.g., t/t5550-git-remote-testgit.sh, t/t5701-git-serve.sh) via environment variables like GIT_TEST_GIT_REMOTE_TESTGIT_EXEC. It supports simulating various server responses, errors, and capabilities for comprehensive testing.

Key features: Verbose logging, immediate ref advertisement, and early exit modes for test control. Not designed for production; behavior may evolve with Git development.

CAVEATS

For Git test suite only; unstable for external use.
Relies on stdin/stdout protocol; direct invocation limited.

INVOCATION IN TESTS

Exported as GIT_TEST_GIT_REMOTE_TESTGIT_EXEC='git-remote-testgit --advertise-refs' to simulate remotes.

HISTORY

Introduced around Git 1.8.4 (2013) in t/helper/remote-testgit.c for remote helper testing. Evolved with protocol updates; key in v2.30+ git-protocol-v2 tests.

SEE ALSO

git-remote(1), git-remote-helpers(7), git-fetch(1), git-push(1)

Copied to clipboard