mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
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>
This commit is contained in:
parent
eac0ccc2cd
commit
ad1a19d0e7
34
builtin/mv.c
34
builtin/mv.c
@ -225,24 +225,22 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
|
||||
else
|
||||
string_list_insert(&src_for_dst, dst);
|
||||
|
||||
if (bad) {
|
||||
if (ignore_errors) {
|
||||
if (--argc > 0) {
|
||||
memmove(source + i, source + i + 1,
|
||||
(argc - i) * sizeof(char *));
|
||||
memmove(destination + i,
|
||||
destination + i + 1,
|
||||
(argc - i) * sizeof(char *));
|
||||
memmove(modes + i, modes + i + 1,
|
||||
(argc - i) * sizeof(enum update_mode));
|
||||
memmove(submodule_gitfile + i,
|
||||
submodule_gitfile + i + 1,
|
||||
(argc - i) * sizeof(char *));
|
||||
i--;
|
||||
}
|
||||
} else
|
||||
die (_("%s, source=%s, destination=%s"),
|
||||
bad, src, dst);
|
||||
if (!bad)
|
||||
continue;
|
||||
if (!ignore_errors)
|
||||
die (_("%s, source=%s, destination=%s"),
|
||||
bad, src, dst);
|
||||
if (--argc > 0) {
|
||||
int n = argc - i;
|
||||
memmove(source + i, source + i + 1,
|
||||
n * sizeof(char *));
|
||||
memmove(destination + i, destination + i + 1,
|
||||
n * sizeof(char *));
|
||||
memmove(modes + i, modes + i + 1,
|
||||
n * sizeof(enum update_mode));
|
||||
memmove(submodule_gitfile + i, submodule_gitfile + i + 1,
|
||||
n * sizeof(char *));
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user