Ticket: 3908: quiet single file overwrite.

If target file exists, MC overwrites that file without confirmation.

The bug has not been fixed comletely in
7d73ce1cbe.

Yet another test case:

1. Create files:

    mkdir -p test1/1 test2/1
    echo "1" > test1/1/file
    echo "2" > test2/1/file

2. Run `mc test1 test2`.
3. Select directory "1" and press F6.

Result: "file" file is overwritten w/o confirmation.

Expected result: since the "file" file exists the confirmation dialog
must be shown.

The problem is: confirmation dialog requires context UI which was not
created in case of single directory move/rename operation.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2018-07-28 17:21:24 +03:00
parent 0bb1db9030
commit 7ac669c654

View File

@ -1940,15 +1940,13 @@ operate_single_file (const WPanel * panel, FileOperation operation, file_op_tota
break; break;
case OP_MOVE: case OP_MOVE:
if (is_file)
{
#ifdef ENABLE_BACKGROUND #ifdef ENABLE_BACKGROUND
/* create UI to show confirmation dialog */ /* create UI to show confirmation dialog */
if (!mc_global.we_are_background) if (!mc_global.we_are_background)
file_op_context_create_ui (ctx, TRUE, FILEGUI_DIALOG_ONE_ITEM); file_op_context_create_ui (ctx, TRUE, FILEGUI_DIALOG_ONE_ITEM);
#endif #endif
if (is_file)
value = move_file_file (panel, tctx, ctx, src, dest); value = move_file_file (panel, tctx, ctx, src, dest);
}
else else
value = do_move_dir_dir (panel, tctx, ctx, src, dest); value = do_move_dir_dir (panel, tctx, ctx, src, dest);
break; break;