Skip to content

Commit

Permalink
Run the git-daemon executable directly
Browse files Browse the repository at this point in the history
So `$!` gives the PID of the daemon itself, in case that helps.

This also no longer displays `GIT_CONFIG_*` vars, which was just to
check that the inflexible hard-coding way used here is okay at
least for initial testing of this change.
  • Loading branch information
EliahKagan committed Dec 17, 2024
1 parent 9686a09 commit 4aa197b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,15 @@ function small-repo-in-sandbox() {
}

function launch-git-daemon() {
local port=9418
local port=9418 exec_path
if nc -z localhost "$port"; then
echo "Port $port should not have been open before this test's run of the git daemon!" >&2
return 1
fi
(
set +e -x
echo 'GIT_CONFIG_* vars START'
printenv | grep ^GIT_CONFIG_
echo 'GIT_CONFIG_* vars END'
) >&2
git -c uploadpack.allowRefInWant=true daemon --verbose --base-path=. --export-all --user-path &>/dev/null &
exec_path="$(git --exec-path)"
# TODO: Maybe dynamically set the `GIT_CONFIG_*` vars, to accommodate preexisting ones.
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=uploadpack.allowRefInWant GIT_CONFIG_VALUE_0=true \
"$exec_path/git-daemon" --verbose --base-path=. --export-all --user-path &>/dev/null &
daemon_pid=$!
while ! nc -z localhost "$port"; do
sleep 0.1
Expand Down

0 comments on commit 4aa197b

Please sign in to comment.