From: Junio C Hamano <gitster@pobox.com>
To: "Jin, Di" <di_jin@brown.edu>
Cc: 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 08:39:49 -0700 [thread overview]
Message-ID: <xmqq1q3iztmi.fsf@gitster.g> (raw)
In-Reply-To: <CAKOkDnMGRfQoNygYLiAxPZB2q=VMYvw8kyu1dM=pM843-FH41Q@mail.gmail.com> (Di Jin's message of "Tue, 23 Jul 2024 22:47:19 -0400")
"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.
When the system cannot do so, you'd get the error message you are
seeing ("fatal: unable to move X to Y").
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.
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.
It would make a good bite-sized #leftoverbits project for aspiring
new Git contributors. Any takers? ;-)
Thanks.
next prev parent reply other threads:[~2024-07-24 15:39 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 [this message]
2024-07-24 17:14 ` Eric Sunshine
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=xmqq1q3iztmi.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=di_jin@brown.edu \
--cc=git@vger.kernel.org \
--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).