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

EXDEV when re-init with --separate-git-dir option

From
JDJin, Di <di_jin@brown.edu>
Date
Jul 24, 2024, 02:47 UTC
Message-ID
<CAKOkDnMGRfQoNygYLiAxPZB2q=VMYvw8kyu1dM=pM843-FH41Q@mail.gmail.com>
Dear maintainers,

We discovered that re-init with option --separate-git-dir will throw an EXDEV when the target directory is not on the same file system as the original directory.

An example is shown below:

$ mkdir -p fs1/gitdir fs2 $ ls fs1 fs2 $ sudo mount -t tmpfs tmpfs fs2 $ cd fs1/gitdir $ git init Initialized empty Git repository in /home/user/fs1/gitdir/.git/ $ git init --separate-git-dir ../../fs2/surrealgitdir fatal: unable to move /home/user/fs1/gitdir/.git to /home/user/fs2/surrealgitdir: Invalid cross-device link

We tested this on version v2.45.2 and after reading the code a bit we believe the issue still exist in the master branch on github (https://github.com/git/git/blob/d19b6cd2dd72dc811f19df4b32c7ed223256c3ee/setup.c#L2280).

Best regards, Di

Next: Junio C Hamano
Message 1 of 3 in “EXDEV when re-init with --separate-git-dir option”
  1. Jin, DiJul 24, 2024
  2. Junio C HamanoJul 24, 2024
  3. Eric SunshineJul 24, 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.