summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a7d9da6)
raw | patch | inline | side by side (parent: a7d9da6)
author | Wincent Colaiuta <win@wincent.com> | |
Thu, 22 Nov 2007 00:02:52 +0000 (01:02 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 22 Nov 2007 10:53:19 +0000 (02:53 -0800) |
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>
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>
builtin-add.c | patch | blob | history | |
commit.h | patch | blob | history |
diff --git a/builtin-add.c b/builtin-add.c
index cf815a0b8ef0e588cfaf25f71747ba7248d19d70..9e3beafe5b2a3d1a547c2c3f53bdedbaf00d280e 100644 (file)
--- a/builtin-add.c
+++ b/builtin-add.c
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;
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);
diff --git a/commit.h b/commit.h
index aa679867a9376496febd5105121b1f49f3ff96a4..d82b8bc3007d09b6a33b20e769d52dcc853cd294 100644 (file)
--- a/commit.h
+++ b/commit.h
int in_merge_bases(struct commit *, struct commit **, int);
-extern int interactive_add(void);
+extern int interactive_add(int argc, const char **argv);
extern void add_files_to_cache(int verbose, const char *prefix, const char **files);
extern int rerere(void);