| 11 | | A really fast move can happen only under the circumstances |
| 12 | | described in the quoted text - everything else will be suboptimal. |
| 13 | | I don't want to block any attempts to move the directory if the |
| 14 | | existing directory is not empty, but it cannot be performed as |
| 15 | | fast. The more dupicate directories exist the performance will get |
| 16 | | worse (in large trees). |
| 17 | | Pavel Tsekov <ptsekov> |
| 18 | | Project Administrator |
| 19 | | Tue 12 Jul 2005 01:09:19 PM UTC, comment #4: |
| | 11 | situation: |
| | 12 | foo/name/file exists. |
| | 13 | bar/name/ exists. |
| | 14 | both on the same partition. |
| | 15 | you're in "foo/", cursor over "name". |
| | 16 | press <f6>, enter "../bar", confirm. |
| | 17 | effect: file is moved by copying. this is because mc incorrectly |
| | 18 | diagnoses a cross-device move. |
| | 19 | the code in question is file.c, move_file_file() & move_dir_dir(). |
| | 20 | when fixing, please consider the case of moving a tree where only a |
| | 21 | subtree is on another device. but maybe it was already considered. :) |
| | 22 | }}} |
| 24 | | empty, but this should not matter. i don't think we want this susv3- |
| 25 | | compliant behavior. at the top level, if the target is an existing |
| 26 | | directory (empty or not), we want to move into this directory (like |
| 27 | | we currently do). once we started recursing, we just merge into |
| 28 | | existing directories. |
| 29 | | frankly, move should behave just like copy. i think it would even |
| 30 | | make sense to merge move into copy with an additional flag. if a |
| 31 | | real move succeeds, skip the recursion. if it fails, do a recursive |
| 32 | | copy+delete. because of the recursion, a real move is attempted at |
| 33 | | every level - exactly what we want. |
| 34 | | Oswald Buddenhagen <ossi> |
| 35 | | Tue 12 Jul 2005 11:53:46 AM UTC, comment #3: |
| | 32 | Comment 2 by Oswald Buddenhagen <ossi> at Mon 11 Jul 2005 05:09:14 PM UTC: |
| | 33 | {{{ |
| | 34 | yes, indeed. i even started developing an algorithm to post here, |
| | 35 | but stopped because the existance checks and file/dir |
| | 36 | discrimination started turning the few lines into real work. :)= |
| | 37 | anyway, the basic idea is: when a move fails, if the source is a |
| | 38 | file, move via copy, otherwise create the target dir (if missing) |
| | 39 | and recursively call the move function for all files in the source |
| | 40 | dir. or something like that. :) |
| | 41 | }}} |
| 58 | | yes, indeed. i even started developing an algorithm to post here, |
| 59 | | but stopped because the existance checks and file/dir |
| 60 | | discrimination started turning the few lines into real work. :)= |
| 61 | | anyway, the basic idea is: when a move fails, if the source is a |
| 62 | | file, move via copy, otherwise create the target dir (if missing) |
| 63 | | and recursively call the move function for all files in the source |
| 64 | | dir. or something like that. :) |
| 65 | | Oswald Buddenhagen <ossi> |
| 66 | | Mon 11 Jul 2005 05:01:24 PM UTC, comment #1: |
| | 64 | Comment 4 by Oswald Buddenhagen <ossi> at Tue 12 Jul 2005 01:09:19 PM UTC: |
| | 65 | {{{ |
| | 66 | > Does `bar/name/' contain any entries or is it empty ? |
| | 67 | > |
| 68 | | Unfortunately there is nothing to fix here :( If the destination |
| 69 | | directory exits, MC decides to use copy_dir_dir() to perform the |
| 70 | | task. What you ask should be fully implemented from scratch. In |
| 71 | | fact move_dir_dir() is quite simplistic. |
| 72 | | Pavel Tsekov <ptsekov> |
| 73 | | Project Administrator |
| 74 | | Mon 11 Jul 2005 03:44:56 PM UTC, original submission: |
| | 69 | empty, but this should not matter. i don't think we want this susv3- |
| | 70 | compliant behavior. at the top level, if the target is an existing |
| | 71 | directory (empty or not), we want to move into this directory (like |
| | 72 | we currently do). once we started recursing, we just merge into |
| | 73 | existing directories. |
| | 74 | frankly, move should behave just like copy. i think it would even |
| | 75 | make sense to merge move into copy with an additional flag. if a |
| | 76 | real move succeeds, skip the recursion. if it fails, do a recursive |
| | 77 | copy+delete. because of the recursion, a real move is attempted at |
| | 78 | every level - exactly what we want. |
| | 79 | }}} |
| 76 | | situation: |
| 77 | | foo/name/file exists. |
| 78 | | bar/name/ exists. |
| 79 | | both on the same partition. |
| 80 | | you're in "foo/", cursor over "name". |
| 81 | | press <f6>, enter "../bar", confirm. |
| 82 | | effect: file is moved by copying. this is because mc incorrectly |
| 83 | | diagnoses a cross-device move. |
| 84 | | the code in question is file.c, move_file_file() & move_dir_dir(). |
| 85 | | when fixing, please consider the case of moving a tree where only a |
| 86 | | subtree is on another device. but maybe it was already considered. :) |
| | 81 | Comment 5 by Pavel Tsekov <ptsekov>: |
| | 82 | {{{ |
| | 83 | A really fast move can happen only under the circumstances |
| | 84 | described in the quoted text - everything else will be suboptimal. |
| | 85 | I don't want to block any attempts to move the directory if the |
| | 86 | existing directory is not empty, but it cannot be performed as |
| | 87 | fast. The more dupicate directories exist the performance will get |
| | 88 | worse (in large trees). |