From: "Kristian Høgsberg" <krh@redhat.com>
To: git@vger.kernel.org
Cc: "Kristian Høgsberg" <krh@redhat.com>
Subject: [PATCH 3/7] Introduce entry point for launching add--interactive.
Date: Mon, 17 Sep 2007 20:06:44 -0400 [thread overview]
Message-ID: <11900740142347-git-send-email-krh@redhat.com> (raw)
In-Reply-To: <1190074014548-git-send-email-krh@redhat.com>
This refactors builtin-add.c a little to provide a unique entry point
for launching git add --interactive, which will be used by
builtin-commit too. If we later want to make add --interactive a
builtin or change how it is launched, we just start from this function.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
---
builtin-add.c | 15 ++++++++++-----
commit.h | 3 +++
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/builtin-add.c b/builtin-add.c
index 0d7d0ce..a5cb910 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -12,6 +12,7 @@
#include "diffcore.h"
#include "commit.h"
#include "revision.h"
+#include "run-command.h"
static const char builtin_add_usage[] =
"git-add [-n] [-v] [-f] [--interactive | -i] [-u] [--refresh] [--] <filepattern>...";
@@ -153,6 +154,13 @@ static int git_add_config(const char *var, const char *value)
return git_default_config(var, value);
}
+int interactive_add(void)
+{
+ const char *argv[2] = { "add--interactive", NULL };
+
+ return run_command_v_opt(argv, RUN_GIT_CMD);
+}
+
static struct lock_file lock_file;
static const char ignore_error[] =
@@ -172,12 +180,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
add_interactive++;
}
if (add_interactive) {
- const char *args[] = { "add--interactive", NULL };
-
- if (add_interactive != 1 || argc != 2)
+ if (argc != 2)
die("add --interactive does not take any parameters");
- execv_git_cmd(args);
- exit(1);
+ exit(interactive_add());
}
git_config(git_add_config);
diff --git a/commit.h b/commit.h
index b779de8..da34c23 100644
--- a/commit.h
+++ b/commit.h
@@ -128,4 +128,7 @@ extern struct commit_list *get_shallow_commits(struct object_array *heads,
int depth, int shallow_flag, int not_shallow_flag);
int in_merge_bases(struct commit *, struct commit **, int);
+
+extern int interactive_add(void);
+
#endif /* COMMIT_H */
--
1.5.3.1.993.gbf388-dirty
next prev parent reply other threads:[~2007-09-18 0:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 0:06 [PATCH 1/7] Enable wt-status output to a given FILE pointer Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 2/7] Enable wt-status to run against non-standard index file Kristian Høgsberg
2007-09-18 0:06 ` Kristian Høgsberg [this message]
2007-09-18 0:06 ` [PATCH 4/7] Clean up stripspace a bit, use strbuf even more Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 5/7] Add strbuf_read_file() Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 6/7] Export rerere() and launch_editor() Kristian Høgsberg
2007-09-18 0:06 ` [PATCH 7/7] Implement git commit as a builtin command Kristian Høgsberg
2007-09-18 13:58 ` Johannes Schindelin
2007-09-18 15:07 ` Kristian Høgsberg
2007-09-20 1:27 ` Junio C Hamano
2007-09-21 17:18 ` Kristian Høgsberg
2007-09-21 19:32 ` Junio C Hamano
2007-09-24 20:27 ` Kristian Høgsberg
2007-09-18 13:14 ` [PATCH 6/7] Export rerere() and launch_editor() Johannes Schindelin
2007-09-19 23:52 ` Junio C Hamano
2007-09-21 18:01 ` Kristian Høgsberg
2007-09-18 13:12 ` [PATCH 4/7] Clean up stripspace a bit, use strbuf even more Johannes Schindelin
2007-09-18 13:52 ` Kristian Høgsberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11900740142347-git-send-email-krh@redhat.com \
--to=krh@redhat.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).