git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git tries to stat //HEAD when searching for a repo, leading to huge delays on Cygwin

From
ABAndrew Baumann <andrew.baumann@microsoft.com>
Date
Nov 2, 2017, 23:45 UTC
Message-ID
<MWHPR21MB0159089DB91A30E5E5CFCB479E5C0@MWHPR21MB0159.namprd21.prod.outlook.com>
Hi,
I have a workaround for this, but someone on stack overflow [1] suggested reporting it upstream, so here you go:
I have a fancy shell prompt that executes "git rev-parse --is-inside-work-tree" to determine whether we're currently inside a working directory. This causes git to walk up the directory hierarchy looking for a containing git repo. For example, when invoked from my home directory, it stats the following paths, in order:

/home/me/.git /home/me/.git/HEAD /home/me/HEAD /home /home/.git /home/.git/HEAD /home/HEAD / /.git /.git/HEAD //HEAD

The last name (//HEAD) interacts badly with Cygwin, which interprets it as a UNC file share, and so demand-loads a bunch of extra DLLs and attempts to resolve/contact the server named HEAD. This obviously doesn't work too well, especially over a slow network link.
I've tested with the latest Cygwin git (2.15.0); this was also present in a prior version.

Cheers, Andrew

[1] https://stackoverflow.com/questions/47084672
Next: Jeff King
Message 1 of 6 in “git tries to stat //HEAD when searching for a repo, leading to huge delays on Cygwin”
  1. Andrew BaumannNov 2, 2017
  2. Jeff KingNov 3, 2017
  3. Johannes SchindelinNov 3, 2017
  4. Jeff KingNov 3, 2017
  5. setup.c: don't try to access '//HEAD' during repo discoverySZEDER Gábor, Nov 3, 2017
  6. Johannes SchindelinNov 3, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.