提交 324ccbd6 编写于 作者: J Junio C Hamano

builtin-add: fix command line building to call interactive

The earlier 7c0ab445 (Teach builtin-add
to pass multiple paths to git-add--interactive) did not allocate enough,
and had unneeded (void*) pointer arithmetic.
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 f64fe7b4
...@@ -138,9 +138,10 @@ static void refresh(int verbose, const char **pathspec) ...@@ -138,9 +138,10 @@ static void refresh(int verbose, const char **pathspec)
int interactive_add(int argc, const char **argv) int interactive_add(int argc, const char **argv)
{ {
int status; int status;
const char **args = xmalloc(sizeof(const char *) * (argc + 1)); const char **args = xcalloc(sizeof(const char *), (argc + 2));
args[0] = "add--interactive"; args[0] = "add--interactive";
memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc); memcpy(&(args[1]), argv, sizeof(const char *) * argc);
args[argc + 1] = NULL; args[argc + 1] = NULL;
status = run_command_v_opt(args, RUN_GIT_CMD); status = run_command_v_opt(args, RUN_GIT_CMD);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册