Search code examples
dvcsfossil

Fossil: "not a valid repository" - deleted repository


I'm trying fossil for the first time, and messed it up within minutes. I created a repository, then apparently ran commands in the wrong folders etc., eventually deleted the test repository, in order to restart. (Somewhere I had read that fossil was "self contained", so I thought, deleting a repository file would be ok. What is the correct way to delete a fossil repository?)

Now, with almost every command I try (incl. "all rebuild"), I get the error "not a valid repository" with the deleted repository name.

What now?


Solution

  • According to this post:

    The "not a valid repository" error only arises when Fossil tries to measure the size of the repository file and sees that either the file does not exist or else that the size of the file is less than 1024 bytes. It does this by calling stat() on the file and looking at the stat.st_size field.

    it seems likely that you have a missing or truncated Fossil file. Make sure you've actually deleted the repository file, and that your filesystem has actually released the file handles. Fossil stores some respository information in ~/.fossil, so you may need to remove that too.

    rm ~/.fossil
    

    In egregious cases, you may want reboot after deleting this file, just to be sure you're working with a clean slate.

    If you're still having problems, try creating a new repository file in a different directory. For example:

    cd /tmp
    fossil init foo.fsl
    fossil open foo.fsl
    fossil close
    

    If all that goes smoothly, you'll have to hunt down whatever remnants of the repository are lurking. As long as the file handles are closed, there's no reason you shouldn't be able to delete foo.fsl (or whatever) and call it good.