1. Summarise the issue (what were doing, what went wrong?)
Imagine a user does this:
# foo is recorded as a file
$ rm foo
$ mkdir foo
$ darcs wh
Darcs currently fails with:
openBinaryFile: inappropriate type (is a directory)
Although this is the fault of the user, we could be more useful here.
2. What behaviour were you expecting instead?
Well, the user has presented quite a tricky situation for darcs.
I think it's best to warn the user that something weird will happen.
I'd like darcs to say something like:
The recorded file, foo has been deleted and replaced by a directory.
If this was not intended, rename the directory foo in the working
and use `darcs revert' to recover the recorded version of the file.
when the users asks whatsnew, and before record.
If a patch is recorded, it should act as if file removal was recorded
and (non-recursively) the directory was added. The user should be able
to explicitly `darcs add` any contents of the directory.
Alternatively, darcs could refuse to do anything until the directory has
been renamed away, but with a nicer error message than is currently
given, something like:
the working directory is inconsistent with the repository state.
foo was recorded as a file, but is now a directory, please rename
this directory to allow darcs to continue.