From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Jin, Di" <di_jin@brown.edu>,
git@vger.kernel.org, Nikos Vasilakis <nikos_vasilakis@brown.edu>,
michael@greenberg.science
Subject: Re: EXDEV when re-init with --separate-git-dir option
Date: Wed, 24 Jul 2024 13:14:49 -0400 [thread overview]
Message-ID: <CAPig+cSJKA5+iU6TfRZev_b+ePLJ=wRm-8PLw3wKqJYEEonOVA@mail.gmail.com> (raw)
In-Reply-To: <xmqq1q3iztmi.fsf@gitster.g>
On Wed, Jul 24, 2024 at 11:40 AM Junio C Hamano <gitster@pobox.com> wrote:
> "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.
prev parent reply other threads:[~2024-07-24 17:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 2:47 EXDEV when re-init with --separate-git-dir option Jin, Di
2024-07-24 15:39 ` Junio C Hamano
2024-07-24 17:14 ` Eric Sunshine [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cSJKA5+iU6TfRZev_b+ePLJ=wRm-8PLw3wKqJYEEonOVA@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=di_jin@brown.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=michael@greenberg.science \
--cc=nikos_vasilakis@brown.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).