Issue 2076 "darcs move myfile" into directory confuses darcs

Title "darcs move myfile" into directory confuses darcs
Priority bug Status resolved
Milestone Resolved in 2.8.0
Superseder Nosy List galbolle, kolmodin
Assigned To galbolle
Topics ThePendingPatch

Created on 2011-06-02.10:37:14 by kolmodin, last changed 2011-10-27.21:33:32 by markstos.

msg14475 (view) Author: kolmodin Date: 2011-06-02.10:37:12

I confused myself and managed to confuse darcs too in the process.
Basically I moved a file (known by darcs) into a directory (not known by darcs) and darcs just dies with
 darcs: /home/kolmodin/code/darcs-tests/darcs_mv3/dir1: openBinaryFile: inappropriate type (is a directory)
on most commands.

Here's how I did it:

# setup the environment
$ darcs -v
2.5.2 (release)
$ darcs init
$ touch file1
$ darcs add file1
$ darcs record file1
$ mkdir dir1

Now I'd like to move "file1" into "dir1", but accidentally forgot to use "darcs mv".

$ mv file1 dir1 # woops!

Correct the mistake by moving file1 with darcs.

$ darcs mv file1 dir1

Now darcs doesn't like me anymore:

$ darcs wh
darcs: /home/kolmodin/code/darcs-tests/darcs_mv_demo/dir1: openBinaryFile: inappropriate type (is a directory)

And I can't undo it:

$ darcs mv dir1 file1
darcs: /home/kolmodin/code/darcs-tests/darcs_mv_demo/dir1: openBinaryFile: inappropriate type (is a directory)

However, if I added "dir1" to the repo before I "darcs mv file1 dir1" it would give me a warning:

$ darcs add dir1
$ darcs mv file1 dir1/
darcs failed:  A file or dir named dir1 (or perhaps differing only in case)
already exists in repository.
Use --case-ok to allow files differing only in case.

Just moving the "dir1" to something makes darcs not crash again:

$ mv dir1 dir2
$ darcs wh .
rmfile ./file1

What do you think? Maybe darcs should have added dir1 to the repo, and then moved file1 into the dir1 
msg14476 (view) Author: kowey Date: 2011-06-02.10:47:24
Bleh, sounds buggy to me.  I'm going to guess this is something pending 
patch related.  Lennart, mind scripting this for us?


I think Darcs has had similar issues before.  Things I don't yet know:
- if this is a regression, maybe worth checking some older darcsen
- if this is a duplicate
- if this has already been fixed (ie. a duplicate)

Perhaps having an automated test would help us.

msg14795 (view) Author: markstos Date: 2011-10-27.21:33:32
This issue is supposedly resolved by this patch:

"Resolve issue 2076: handle post-hoc move into an non-added directory"
Date User Action Args
2011-06-02 10:37:14kolmodincreate
2011-06-02 10:47:25koweysetpriority: bug
status: unknown -> needs-reproduction
topic: + ThePendingPatch
messages: + msg14476
2011-06-11 10:02:08galbollesetassignedto: galbolle
nosy: + galbolle
2011-06-14 13:32:51galbollesetstatus: needs-reproduction -> has-patch
2011-10-27 21:33:32markstossetstatus: has-patch -> resolved
messages: + msg14795
resolvedin: 2.8.0