aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-25 11:02:01 -0700
committerJunio C Hamano <gitster@pobox.com>2014-03-25 11:02:02 -0700
commit12de60ac7a870cf0717ebbd9a150100219559f83 (patch)
treef2d323951b9b2fcb6632a5092578388f83143313 /builtin
parent2dfefe0f89447ff4f358d5f294c0b56148a0df4c (diff)
parentfb8a4e8079ab8fc37e9cde32957c35637280ab8f (diff)
downloadgit-12de60ac7a870cf0717ebbd9a150100219559f83.tar.gz
git-12de60ac7a870cf0717ebbd9a150100219559f83.tar.xz
Merge branch 'jk/mv-submodules-fix'
"git mv" that moves a submodule forgot to adjust the array that uses to keep track of which submodules were to be moved to update its configuration. * jk/mv-submodules-fix: mv: prevent mismatched data when ignoring errors. builtin/mv: fix out of bounds write
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/builtin/mv.c b/builtin/mv.c
index 7e26eb522..2a7243f52 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -180,6 +180,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
modes = xrealloc(modes,
(argc + last - first)
* sizeof(enum update_mode));
+ submodule_gitfile = xrealloc(submodule_gitfile,
+ (argc + last - first)
+ * sizeof(char *));
}
dst = add_slash(dst);
@@ -193,6 +196,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
prefix_path(dst, dst_len,
path + length + 1);
modes[argc + j] = INDEX;
+ submodule_gitfile[argc + j] = NULL;
}
argc += last - first;
}
@@ -228,6 +232,11 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
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