mv: flatten error handling code block

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nguyễn Thái Ngọc Duy 2014-08-10 09:29:30 +07:00 committed by Junio C Hamano
parent eac0ccc2cd
commit ad1a19d0e7
1 changed files with 16 additions and 18 deletions

View File

@ -225,24 +225,22 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
else else
string_list_insert(&src_for_dst, dst); string_list_insert(&src_for_dst, dst);


if (bad) { if (!bad)
if (ignore_errors) { continue;
if (--argc > 0) { if (!ignore_errors)
memmove(source + i, source + i + 1, die (_("%s, source=%s, destination=%s"),
(argc - i) * sizeof(char *)); bad, src, dst);
memmove(destination + i, if (--argc > 0) {
destination + i + 1, int n = argc - i;
(argc - i) * sizeof(char *)); memmove(source + i, source + i + 1,
memmove(modes + i, modes + i + 1, n * sizeof(char *));
(argc - i) * sizeof(enum update_mode)); memmove(destination + i, destination + i + 1,
memmove(submodule_gitfile + i, n * sizeof(char *));
submodule_gitfile + i + 1, memmove(modes + i, modes + i + 1,
(argc - i) * sizeof(char *)); n * sizeof(enum update_mode));
i--; memmove(submodule_gitfile + i, submodule_gitfile + i + 1,
} n * sizeof(char *));
} else i--;
die (_("%s, source=%s, destination=%s"),
bad, src, dst);
} }
} }