aboutsummaryrefslogtreecommitdiff
path: root/builtin/mv.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-08-10 09:29:30 +0700
committerJunio C Hamano <gitster@pobox.com>2014-08-11 10:48:07 -0700
commitad1a19d0e7cdd69fd4902b80ab691d43b102e3e2 (patch)
tree776eacf3c9906e47eb4280351dd4efb78056fcbe /builtin/mv.c
parenteac0ccc2cd0022546b5037a5aabef8ec687bb60a (diff)
downloadgit-ad1a19d0e7cdd69fd4902b80ab691d43b102e3e2.tar.gz
git-ad1a19d0e7cdd69fd4902b80ab691d43b102e3e2.tar.xz
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>
Diffstat (limited to 'builtin/mv.c')
-rw-r--r--builtin/mv.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index b892f63df..c48129e30 100644
--- a/builtin/mv.c
+++ b/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--;
}
}