From e07d91a6f67c1c4adb897096cb13d6cd1b98cf42 Mon Sep 17 00:00:00 2001
From: Eliah Kagan <degeneracypressure@gmail.com>
Date: Sun, 1 Oct 2023 15:31:00 -0400
Subject: [PATCH 1/2] Drop claim about Cygwin not having git-daemon

On a current Cygwin system with git 2.39.0 (the latest version
offered by the Cygwin package manager), git-daemon is present, with
the Cygwin path /usr/libexec/git-core/git-daemon.exe.

In addition, the cygwin-test.yml workflow does not take any special
steps to allow git-daemon to work, but all tests pass in it even
without skipping or xfailing tests that seem related to git-daemon.

The git_daemon_launched function in test/lib/helper.py only invokes
git-daemon directly (rather than through "git daemon") when is_win
evaluates true, which only happens on native Windows systems, not
Cygwin, which is treated the same as (other) Unix-like systems and
still works. So maybe Cygwin git-daemon was never a special case.

Whether or not it was, the message about git-daemon needing to be
findable in a PATH search is also under an is_win check, and thus
is never shown on Cygwin. So I've removed the Cygwin part of that
message. (Because the path shown is a MinGW-style path, I have kept
the wording about that being for MinGW-git, even though it is no
longer needed to disambiguate the Cygwin case.)
---
 README.md          |  3 +--
 test/lib/helper.py | 15 ++++++---------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index c7c2992e3..65c1e7bae 100644
--- a/README.md
+++ b/README.md
@@ -119,8 +119,7 @@ executed `git fetch --tags` followed by the `./init-tests-after-clone.sh`
 script in the repository root. Otherwise you will encounter test failures.
 
 On _Windows_, make sure you have `git-daemon` in your PATH. For MINGW-git, the `git-daemon.exe`
-exists in `Git\mingw64\libexec\git-core\`; CYGWIN has no daemon, but should get along fine
-with MINGW's.
+exists in `Git\mingw64\libexec\git-core\`.
 
 #### Install test dependencies
 
diff --git a/test/lib/helper.py b/test/lib/helper.py
index e8464b7d4..9656345de 100644
--- a/test/lib/helper.py
+++ b/test/lib/helper.py
@@ -177,12 +177,10 @@ def git_daemon_launched(base_path, ip, port):
     gd = None
     try:
         if is_win:
-            ## On MINGW-git, daemon exists in .\Git\mingw64\libexec\git-core\,
-            #  but if invoked as 'git daemon', it detaches from parent `git` cmd,
-            #  and then CANNOT DIE!
-            #  So, invoke it as a single command.
-            ## Cygwin-git has no daemon.  But it can use MINGW's.
-            #
+            # On MINGW-git, daemon exists in Git\mingw64\libexec\git-core\,
+            # but if invoked as 'git daemon', it detaches from parent `git` cmd,
+            # and then CANNOT DIE!
+            # So, invoke it as a single command.
             daemon_cmd = [
                 "git-daemon",
                 "--enable=receive-pack",
@@ -217,12 +215,11 @@ def git_daemon_launched(base_path, ip, port):
         )
         if is_win:
             msg += textwrap.dedent(
-                r"""
+                R"""
 
             On Windows,
               the `git-daemon.exe` must be in PATH.
-              For MINGW, look into .\Git\mingw64\libexec\git-core\), but problems with paths might appear.
-              CYGWIN has no daemon, but if one exists, it gets along fine (but has also paths problems)."""
+              For MINGW, look into \Git\mingw64\libexec\git-core\, but problems with paths might appear."""
             )
         log.warning(msg, ex, ip, port, base_path, base_path, exc_info=1)
 

From 35e3875cb71913771885646f294cd25cd19c35f3 Mon Sep 17 00:00:00 2001
From: Eliah Kagan <degeneracypressure@gmail.com>
Date: Sun, 1 Oct 2023 17:06:47 -0400
Subject: [PATCH 2/2] Allow base_daemon_path to be normalized for Cygwin

Since the Cygwin git-daemon can be used.
---
 test/lib/helper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/lib/helper.py b/test/lib/helper.py
index 9656345de..1de904610 100644
--- a/test/lib/helper.py
+++ b/test/lib/helper.py
@@ -302,7 +302,7 @@ def remote_repo_creator(self):
                     cw.set("url", remote_repo_url)
 
                 with git_daemon_launched(
-                    Git.polish_url(base_daemon_path, is_cygwin=False),  # No daemon in Cygwin.
+                    Git.polish_url(base_daemon_path),
                     "127.0.0.1",
                     GIT_DAEMON_PORT,
                 ):