diff options
author | Wincent Colaiuta <win@wincent.com> | 2007-11-22 01:02:52 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-22 02:53:19 -0800 |
commit | 7c0ab4458994aa895855abc4a504cf693ecc0cf1 (patch) | |
tree | 3529926f2ec2fe67be99808bf245d841e9bbc24e /builtin-add.c | |
parent | a7d9da6c972cb7bc79ef47ad7199dfb2a8dcf67f (diff) | |
download | git-7c0ab4458994aa895855abc4a504cf693ecc0cf1.tar.gz git-7c0ab4458994aa895855abc4a504cf693ecc0cf1.tar.xz |
Teach builtin-add to pass multiple paths to git-add--interactive
Instead of just accepting a single file parameter, git-add now accepts
any number of path parameters, fowarding them to git-add--interactive.
Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-add.c')
-rw-r--r-- | builtin-add.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/builtin-add.c b/builtin-add.c index cf815a0b8..9e3beafe5 100644 --- a/builtin-add.c +++ b/builtin-add.c @@ -135,11 +135,17 @@ static void refresh(int verbose, const char **pathspec) free(seen); } -int interactive_add(void) +int interactive_add(int argc, const char **argv) { - const char *argv[2] = { "add--interactive", NULL }; - - return run_command_v_opt(argv, RUN_GIT_CMD); + int status; + const char **args = xmalloc(sizeof(const char *) * (argc + 1)); + args[0] = "add--interactive"; + memcpy((void *)args + sizeof(const char *), argv, sizeof(const char *) * argc); + args[argc + 1] = NULL; + + status = run_command_v_opt(args, RUN_GIT_CMD); + free(args); + return status; } static struct lock_file lock_file; @@ -163,17 +169,14 @@ static struct option builtin_add_options[] = { int cmd_add(int argc, const char **argv, const char *prefix) { - int i, newfd, orig_argc = argc; + int i, newfd; const char **pathspec; struct dir_struct dir; argc = parse_options(argc, argv, builtin_add_options, builtin_add_usage, 0); - if (add_interactive) { - if (add_interactive != 1 || orig_argc != 2) - die("add --interactive does not take any parameters"); - exit(interactive_add()); - } + if (add_interactive) + exit(interactive_add(argc, argv)); git_config(git_default_config); |