Fossil Forum
Post: How to move file within repo?
Hello,
I need to move a file.
After moving it physically with Windows, how do I tell Fossil to also move it within the repo? I know about the "--hard" option but prefer to do it in two steps.
Note: Both the repo and _FOSSIL_ live at the root of D:\
(Windows) move "d:\SOURCE\myfile.txt "d:\TARGET\"
fossil mv "SOURCE/myfile.txt" "TARGET/myfile.txt"
fossil changes
MISSING /../SOURCE/myfile.txt
Thank you.
Hello,
I need to move a file.
After moving it physically with Windows, how do I tell Fossil to also move it within the repo? I know about the "--hard" option but prefer to do it in two steps.
Note: Both the repo and _FOSSIL_ live at the root of D:\
(Windows) move "d:\SOURCE\myfile.txt "d:\TARGET\"
fossil mv "SOURCE/myfile.txt" "TARGET/myfile.txt"
fossil changes
MISSING /../SOURCE/myfile.txt
Thank you.
-- Edit: A heading / is required:
fossil mv "/SOURCE/myfile.txt" "/TARGET/myfile.txt"
Hello,
I need to move a file.
After moving it physically with Windows, how do I tell Fossil to also move it within the repo? I know about the "--hard" option but prefer to do it in two steps.
Note: Both the repo and _FOSSIL_ live at the root of D:\
(Windows) move "d:\SOURCE\myfile.txt "d:\TARGET\"
fossil mv "SOURCE/myfile.txt" "TARGET/myfile.txt"
fossil changes
MISSING /../SOURCE/myfile.txt
Thank you.
Hello,
I need to move a file.
After moving it physically with Windows, how do I tell Fossil to also move it within the repo? I know about the "--hard" option but prefer to do it in two steps.
Note: Both the repo and _FOSSIL_ live at the root of D:\
(Windows) move "d:\SOURCE\myfile.txt "d:\TARGET\"
fossil mv "SOURCE/myfile.txt" "TARGET/myfile.txt"
fossil changes
MISSING /../SOURCE/myfile.txt
Thank you.
-- Edit: A heading / is required:
fossil mv "∕SOURCE/myfile.txt" "/TARGET/myfile.txt"
Z
live at the root of D:
If my memory serves properly, fossil doesn't work well at the root for reasons lost to memory (or which may have been imagined, but it's definitely come up before).
The issue might be that unlike a normal directory D:\.. does not resolve to D: (which is not a directory) but D:\ i.e. itself. That makes sense of MISSING /../SOURCE/myfile.txt.
I suspect fossil ls might be interesting...
Linux, or at least WSL, seems to be the same: /.. is /
I prefer to locate the repo at the root of D so I can add any file anywhere on the disk below.
Linux, or at least WSL, seems to be the same: /.. is /
That's one of those weird filesystem quirks which eventually leads to the question of "if '/' is the separator then what is the root directory's name?" It's all very troubling :/.
[stephan@nuc:/]$ pwd; cd ../../../../; echo rc=$?; pwd
/
rc=0
/
That unfortunately doesn't offer any solutions for to the OP, only my vague recollection that something in fossil wasn't really happy with a checkout in a root directory.
I prefer to locate the repo at the root of D so I can add any file anywhere on the disk below.
Whereas fossil is Unix-centric and doesn't store file permissions, which are important when storing arbitrary stuff from /..., so it's never been an "actively supported" use case.
Whereas fossil is Unix-centric ...
Indeed, so this limitation only affect 1 "location" for the checkout ("/"), while on windows any "root" of a drive (e.g. d:) cannot be use, which is a bit the equivalent of any mount point on unix.
Edit reply: How to move file within repo?
I think I've got the reasons for this figured out.
Yes, reasons, plural:
-
We had a platform-independent bug where paths involving the file system root would return a -1 on removing the last directory component, causing the calling function to index a string backwards. At best, this segfaulted
fossil, preventing it from doing what you asked. A fix for this is on trunk even though no sane Fossil user will root a checkout at/on a POSIX system. -
That judgement misfires on a system with > 1 file system root, as on Windows, but the foundational segfault fix isn't enough. There remained code paths that were not handling drive letters properly, causing assorted badness to then occur.
-
Even with those fixed, one more problem remained because Windows keeps an independent CWD for each drive, so that
cd d:only means the same thing ascd d:/when that CWD was already at the D drive root. The POSIX-first code in Fossil's file handling tries to avoid path concatenations of the form/+/tmp==//tmpbut what can occur on Windows isD:\+tmp=D:tmpwhich is not the same thing!Where it gets truly sticky is with Cygwin's UNC accommodations, where this might be rendered as
//d/tmpinstead, which means thetmpdirectory on file server "d". This is not only a consistent translation of Windows backslashes, it was set aside by POSIX as having local special meanings, probably to accommodate Apollo Domain/OS. This is why the Cygwin devs adopted the/cygdriveconvention many years ago, but they left a method for people like me who wanted the old shortcut back.
Bottom line, this is a frightful mess, which is why this fix is isolated to a branch until it gets thoroughly banged on by people with an actual need for it to work. (Not me.)