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

Re: [BUG] Clones from local repositories do not work correctly under Windows

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 12, 2024, 21:53 UTC
Message-ID
<ee644475-8387-4dbf-a4b9-0d301bd7cf5b@kdbg.org>
In-Reply-To
<xmqqil0mmqpx.fsf@gitster.g>
Am 12.04.24 um 19:32 schrieb Junio C Hamano:
Show 23 quoted lines
> Johannes Sixt <j6t@kdbg.org> writes:
> 
>> alternate: C:/Temp/repoorig/.git/objects
>> alternate: /c/Temp/repoorig/.git/objects
>>
>> This is the MSYS2/Cygwin absolute path with a "drive letter".
>> Unfortunately, this kind of path is unintelligible for Git for Windows.
>> It expects absolute paths to begin with drive letter-colon or a
>> double-slash or double-backslash. For this reason, it reports "unable to
>> normalize alternate object path".
>>
>> The conclusion is: Do not use two different flavors of Git on a
>> repository that is set up with a link to an alternate repository.
> 
> I do not complain to the conclusion, and I do not use Windows, but
> it makes me wonder if there is a way to spell that full path that
> can be understood by both implementations.  The two implementations
> are not incompatible in the actual object contents and refnames and
> other things in .git/ directory, are they?
> 
> In short, does MSYS2/Cygwin understand paths in "C:/Temp/..." style,
> and if so, writing that out, even though it may not what it
> considers the native format, would make the world a happier place.

Yes, MSYS2 should understand C:/Temp. This can be achieved easily by doing the clone with Git for Windows. A small complication is, though, that the actual contents of the .git/objects/info/alternates is constructed from the literal command line arguments. In my test I used

   git clone -s C:\Temp\repoorig repoclone
which writes
   C:\Temp\repoorig/.git/objects

to the file. The path we see in the output of count-objects -v is obviously a normalized version. Users will have to say

   git clone -s C:/Temp/repoorig repoclone
to get the more widely understood version into the file.
-- Hannes
Previous: L. E. Segovia
Message 9 of 9 in “[BUG] Clones from local repositories do not work correctly under Windows”
  1. L. E. SegoviaApr 11, 2024
  2. Johannes SixtApr 12, 2024
  3. L. E. SegoviaApr 12, 2024
  4. Johannes SixtApr 12, 2024
  5. L. E. SegoviaApr 12, 2024
  6. Junio C HamanoApr 12, 2024
  7. rsbecker@nexbridge.comApr 12, 2024
  8. L. E. SegoviaApr 12, 2024
  9. Johannes SixtApr 12, 2024

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.