Skip to content

Commit

Permalink
builtin-add: fix command line building to call interactive
Browse files Browse the repository at this point in the history
The earlier 7c0ab44 (Teach builtin-add
to pass multiple paths to git-add--interactive) did not allocate enough,
and had unneeded (void*) pointer arithmetic.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Junio C Hamano committed Nov 25, 2007
1 parent f64fe7b commit 324ccbd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions builtin-add.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ static void refresh(int verbose, const char **pathspec)
int interactive_add(int argc, const char **argv)
{
int status;
const char **args = xmalloc(sizeof(const char *) * (argc + 1));
const char **args = xcalloc(sizeof(const char *), (argc + 2));

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;

status = run_command_v_opt(args, RUN_GIT_CMD);
Expand Down

0 comments on commit 324ccbd

Please sign in to comment.