You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to map/include the a subdirectory of one repo to the root of another, as shown here. This fails with the following error (formatted):
failed to copy 'infra-mk3-actual' include from /cluster/gitops/. to /:
link error: cannot rename /tmp/flux-include-735574679/unpack/cluster/gitops to /tmp/gitrepository-flux-system-infra-mk3-328487949:
rename /tmp/flux-include-735574679/unpack/cluster/gitops /tmp/gitrepository-flux-system-infra-mk3-328487949:
file exists
// renameFallback attempts to determine the appropriate fallback to failed rename// operation depending on the resulting error.funcrenameFallback(errerror, src, dststring) error {
// Rename may fail if src and dst are on different devices; fall back to// copy if we detect that case. syscall.EXDEV is the common name for the// cross device link error which has varying output text across different// operating systems.terr, ok:=err.(*os.LinkError)
if!ok {
returnerr
} elseifterr.Err!=syscall.EXDEV { // This is where the problem occursreturnfmt.Errorf("link error: cannot rename %s to %s: %w", src, dst, terr)
}
returnrenameByCopy(src, dst)
}
This can be fixed by simply checking if the error is an EEXIST error, and running renameByCopy if so:
// renameFallback attempts to determine the appropriate fallback to failed rename// operation depending on the resulting error.funcrenameFallback(errerror, src, dststring) error {
// Rename may fail if src and dst are on different devices; fall back to// copy if we detect that case. syscall.EXDEV is the common name for the// cross device link error which has varying output text across different// operating systems.terr, ok:=err.(*os.LinkError)
if!ok {
returnerr
} elseifterr.Err!=syscall.EXDEV&&terr.Err!=syscall.EEXIST {
returnfmt.Errorf("link error: cannot rename %s to %s: %w", src, dst, terr)
}
returnrenameByCopy(src, dst)
}
The text was updated successfully, but these errors were encountered:
I'm attempting to map/include the a subdirectory of one repo to the root of another, as shown here. This fails with the following error (formatted):
Linking fails, but copying should succeed without issue. The problem is that the
renameFallback
function errors if linking failed, except in the case where the link is cross-device:This can be fixed by simply checking if the error is an
EEXIST
error, and runningrenameByCopy
if so:The text was updated successfully, but these errors were encountered: