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

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Jul 24, 2024, 17:14 UTC
Message-ID
<CAPig+cSJKA5+iU6TfRZev_b+ePLJ=wRm-8PLw3wKqJYEEonOVA@mail.gmail.com>
In-Reply-To
<xmqq1q3iztmi.fsf@gitster.g>
On Wed, Jul 24, 2024 at 11:40 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> "Jin, Di" <di_jin@brown.edu> writes:
> > 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.
>
> Yup, it is hitting the limitation of your filesystem.  The code
> wants to move the original .git directory together with its contents
> to a new place, and it makes a single rename() system call to do so.
> [...]
> The code path could probably borrow some code to recursively "copy"
> directory from the local "git clone" code path, and then invent a
> new code to recursively remove the original ".git", and trigger that
> new code when rename() fails.

Re-init with --separate-git-dir isn't the only problem spot. `git worktree move` also suffers the same problem for the same reason.

> But at that point, only as a fall-back measure, it might be simpler
> and much less error prone to spawn a "mv src dst" as a subprocess
> using the run_command() API.
This wouldn't help Windows users.
> It would make a good bite-sized #leftoverbits project for aspiring
> new Git contributors.  Any takers?  ;-)

It might be a bit more than bite-sized, though, considering the above points about `git worktree move` also needing such a fix, and having to deal with Microsoft Windows.

Previous: Junio C Hamano
Message 3 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.