Skip to content

Commit

Permalink
Merge branch '4563_reget_on_move'
Browse files Browse the repository at this point in the history
* 4563_reget_on_move:
  Ticket #4563: support reget in file move operation.
  • Loading branch information
aborodin committed Jul 28, 2024
2 parents cd8355b + cc34729 commit dbca937
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/filemanager/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2274,8 +2274,12 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx,
vfs_path_t *src_vpath = NULL, *dst_vpath = NULL;
char *buf = NULL;

/* FIXME: We should not be using global variables! */
ctx->do_reget = 0;
/* Keep the non-default value applied in chain of calls:
move_file_file() -> file_progress_real_query_replace()
move_file_file() -> copy_file_file() */
if (ctx->do_reget < 0)
ctx->do_reget = 0;

return_status = FILE_RETRY;

dst_vpath = vfs_path_from_str (dst_path);
Expand Down
2 changes: 1 addition & 1 deletion src/filemanager/filegui.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ overwrite_query_dialog (file_op_context_t *ctx, enum OperationMode mode)

/* will "Append" and "Reget" buttons be in the dialog? */
do_append = !S_ISDIR (ui->dst_stat->st_mode);
do_reget = do_append && ctx->operation == OP_COPY && ui->dst_stat->st_size != 0
do_reget = do_append && ui->dst_stat->st_size != 0
&& ui->src_stat->st_size > ui->dst_stat->st_size;

NEW_LABEL (8, dlg_widgets[8].text);
Expand Down
2 changes: 1 addition & 1 deletion src/filemanager/fileopctx.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ file_op_context_new (FileOperation op)
ctx->operation = op;
ctx->eta_secs = 0.0;
ctx->progress_bytes = 0;
ctx->do_reget = 1;
ctx->do_reget = -1;
ctx->stat_func = mc_lstat;
ctx->preserve = TRUE;
ctx->preserve_uidgid = (geteuid () == 0);
Expand Down

0 comments on commit dbca937

Please sign in to comment.