How to replace a file with a directory?
(1) By anonymous on 2019-09-04 00:01:17 [link] [source]
I am tracking software releases using a vendor branch and making my additions on the trunk.
To update I do the following:
fossil update vendor
tar -xzvf vendor_file.tgz --strip-component=1
this unpacks the tarball in the current directory overlaying the previous vendor files. I then delete/add old/new files.
In this release a file let's call it retool was replaced by a directory retool with files under it.
This leads to the error:
not an ordinary file: /.../retool/retool abort due to prior errors
when running fossil diff or commit (timeline works, but I didn't try other commands).
I was thinking of doing the following:
fossil revert # to get the last vendor branch version
fossil rm --hard retool/retool
fossil ci -m "remove old retool file"
then do the:
tar -xzvf file.tgz ....
followed by
fossil --tag release-3.2 -m "..."
Is this the best way to do this or have I uncovered a bug in fossil?
Also given this surgery, should I expect an issue with:
fossil up trunk
fossil merge vendor
Will the directory overlay the existing file in the trunk checkout, or should I delete the file from trunk before I do the merge?
-- rouilj
(2) By Richard Hipp (drh) on 2019-09-04 00:20:44 in reply to 1 [link] [source]
Your suggested approach is what I was going to recommend trying. But I've never done it myself and don't know how it will go.
(3) By anonymous on 2019-09-04 01:32:57 in reply to 2 [source]
The directions above succeeded for the checkin with one exception.
fossil revert
had issues and left me with a retool/retool directory with mode 644. Once I chmod 755 and manually deleted the directory I was able to rerun the fossil revert and get a clean directory back.
I then did a:
fossil up trunk
and again ended up with a wacky update because of the retool directory. The output was normal until:
ADD .../retool/retool
/.../retool/retool is directory, cannot overwrite
Rolling back prior filesystem changes...
...
again I had a mode 644 retool/retool directory. Doing a chmod 755 retool/retool fossil diff -r vendor showed no changes.
Then an rm -rf retool/retool followed by a fossil up trunk resulted in:
ADD retool/retool
CONFLICT retool/retool/start.sh
CONFLICT retool/retool/open.sh
... continues for all files in retool/retool
but if I run fossil status it doesn't list any files and retool/retool is a file as expected.
If I now run fossil merge vendor it works ok replacing retool/retool with a directory. fossil diff reports:
ADDED_BY_MERGE retool/retool/start.sh
ADDED retool/retool
running fossil diff a second time leads to:
not an ordinary file: /.../retool/retool
abort due to prior errors
rm -rf on retool/retool followed by a fossil revert seems to put the working directory back into an unbroken state at the tip of trunk.
fossil rm --hard retool/retool
fossil ci -m "clearing space for directory"
fossil merge vendor
seems to have worked. The build completed at least.
Hopefully this is helpful for others.